Skip to content

Commit

Permalink
7260: Create a new serializers bundle
Browse files Browse the repository at this point in the history
Reviewed-by: jbachorik, hdafgard, aptmac
  • Loading branch information
thegreystone committed Jun 2, 2021
1 parent 103245e commit 8c28f1b
Show file tree
Hide file tree
Showing 33 changed files with 632 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.openjdk.jmc.flightrecorder.serializers"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.openjdk.jmc.rjmx.services.jfr"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Bundle-Name: FlameView
Bundle-SymbolicName: org.openjdk.jmc.flightrecorder.flameview;singleton:=true
Bundle-Version: 8.1.0.qualifier
Require-Bundle: org.openjdk.jmc.flightrecorder,
org.openjdk.jmc.flightrecorder.serializers,
org.openjdk.jmc.flightrecorder.ui,
org.openjdk.jmc.flightrecorder.rules,
org.openjdk.jmc.common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
import org.openjdk.jmc.common.item.IItemCollection;
import org.openjdk.jmc.common.item.ItemCollectionToolkit;
import org.openjdk.jmc.common.util.StringToolkit;
import org.openjdk.jmc.flightrecorder.flameview.FlameGraphJsonMarshaller;
import org.openjdk.jmc.flightrecorder.flameview.FlameviewImages;
import org.openjdk.jmc.flightrecorder.serializers.json.FlameGraphJsonSerializer;
import org.openjdk.jmc.flightrecorder.stacktrace.FrameSeparator;
import org.openjdk.jmc.flightrecorder.stacktrace.FrameSeparator.FrameCategorization;
import org.openjdk.jmc.flightrecorder.stacktrace.tree.StacktraceTreeModel;
Expand Down Expand Up @@ -302,7 +302,7 @@ public void run() {
if (isInvalid) {
return;
}
String flameGraphJson = FlameGraphJsonMarshaller.toJson(treeModel);
String flameGraphJson = FlameGraphJsonSerializer.toJson(treeModel);
if (isInvalid) {
return;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ Bundle-ManifestVersion: 2
Bundle-Name: GraphView
Bundle-SymbolicName: org.openjdk.jmc.flightrecorder.graphview;singleton:=true
Bundle-Version: 8.1.0.qualifier
Require-Bundle: org.openjdk.jmc.flightrecorder;bundle-version="8.1.0",
org.openjdk.jmc.flightrecorder.ui;bundle-version="8.1.0",
Require-Bundle: org.openjdk.jmc.flightrecorder,
org.openjdk.jmc.flightrecorder.ui,
org.openjdk.jmc.flightrecorder.serializers,
org.junit,
org.junit.jupiter.api,
org.junit.jupiter.engine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
import org.openjdk.jmc.common.item.ItemCollectionToolkit;
import org.openjdk.jmc.common.util.Pair;
import org.openjdk.jmc.common.util.StringToolkit;
import org.openjdk.jmc.flightrecorder.ext.graphview.graph.DotGenerator;
import org.openjdk.jmc.flightrecorder.serializers.dot.DotSerializer;
import org.openjdk.jmc.flightrecorder.stacktrace.FrameSeparator;
import org.openjdk.jmc.flightrecorder.stacktrace.FrameSeparator.FrameCategorization;
import org.openjdk.jmc.flightrecorder.stacktrace.graph.StacktraceGraphModel;
Expand Down Expand Up @@ -327,7 +327,7 @@ private static String toDot(StacktraceGraphModel model, int maxNodesRendered) {
}

private static String render(StacktraceGraphModel model, int maxNodesRendered) {
return DotGenerator.toDot(model, maxNodesRendered, DotGenerator.getDefaultConfiguration());
return DotSerializer.toDot(model, maxNodesRendered, DotSerializer.getDefaultConfiguration());
}

private static String loadLibraries(String ... libs) {
Expand Down
7 changes: 6 additions & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -166,6 +166,11 @@
<artifactId>flightrecorder.rules.jdk</artifactId>
<version>${revision}${changelist}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmc</groupId>
<artifactId>flightrecorder.serializers</artifactId>
<version>${revision}${changelist}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmc</groupId>
<artifactId>jdp</artifactId>
Expand Down

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions application/tests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -45,7 +45,6 @@
<module>org.openjdk.jmc.flightrecorder.controlpanel.ui.configuration.test</module>
<module>org.openjdk.jmc.flightrecorder.controlpanel.ui.test</module>
<module>org.openjdk.jmc.flightrecorder.ext.jfx.test</module>
<module>org.openjdk.jmc.flightrecorder.flameview.test</module>
<module>org.openjdk.jmc.flightrecorder.ui.test</module>
<module>org.openjdk.jmc.greychart.test</module>
<module>org.openjdk.jmc.ide.launch.test</module>
Expand Down
7 changes: 5 additions & 2 deletions configuration/ide/eclipse/dictionary/dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

accessor
accessors
affine
Expand All @@ -10,6 +11,7 @@ combinable
commensurability
conformance
darkens
datadog
decompressed
deserialization
enablement
Expand All @@ -27,6 +29,7 @@ introspected
introspecting
iterable
javascript
jfr
jigsaw
kibibytes
kleene
Expand All @@ -48,6 +51,7 @@ refactored
reimplemented
rethink
serializable
serializers
servlet
stacktrace
stacktraces
Expand All @@ -65,10 +69,9 @@ unparsable
unpersistable
username
versioning
xml
whitelisted
wildcard
wildcards
zip
zipped
datadog
xml
39 changes: 39 additions & 0 deletions core/org.openjdk.jmc.flightrecorder.serializers/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="${rootDir}/license">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Name: Common Plug-in
Bundle-SymbolicName: org.openjdk.jmc.flightrecorder.serializers;singleton:=true
Bundle-Version: 8.1.0.qualifier
Bundle-Vendor: Oracle Corporation
Export-Package: org.openjdk.jmc.flightrecorder.serializers,
org.openjdk.jmc.flightrecorder.serializers.json,
org.openjdk.jmc.flightrecorder.serializers.dot
Automatic-Module-Name: org.openjdk.jmc.flightrecorder.serializers
Require-Bundle: org.lz4.lz4-java, org.openjdk.jmc.flightrecorder
39 changes: 39 additions & 0 deletions core/org.openjdk.jmc.flightrecorder.serializers/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2021, Datadog, Inc. All rights reserved.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The contents of this file are subject to the terms of either the Universal Permissive License
# v 1.0 as shown at http://oss.oracle.com/licenses/upl
#
# or the following license:
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided with
# the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to
# endorse or promote products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
source.. = src/main/java/,\
src/main/resources/
output.. = target/classes/
bin.includes = META-INF/,\
.
pde.match.rule.bundle=compatible
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, Datadog, Inc. All rights reserved.
<!--
Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2021, Datadog, Inc. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -36,13 +36,28 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openjdk.jmc</groupId>
<artifactId>missioncontrol.application.tests</artifactId>
<artifactId>missioncontrol.core</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>org.openjdk.jmc.flightrecorder.flameview.test</artifactId>
<packaging>eclipse-test-plugin</packaging>

<artifactId>flightrecorder.serializers</artifactId>
<properties>
<spotless.config.path>${basedir}/../../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
</properties>
<dependencies>
<dependency>
<groupId>org.openjdk.jmc</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmc</groupId>
<artifactId>flightrecorder</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Datadog, Inc. All rights reserved.
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, Datadog, Inc. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -31,7 +31,7 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openjdk.jmc.flightrecorder.ext.graphview.graph;
package org.openjdk.jmc.flightrecorder.serializers.dot;

import java.io.File;
import java.io.IOException;
Expand All @@ -53,7 +53,7 @@
* Converts a {@link StacktraceGraphModel} to DOT format text. This format can, for example, be used
* by d3-graphviz, to visualize the graphs.
*/
public final class DotGenerator {
public final class DotSerializer {
private static final String DEFAULT_NAME = "Unnamed";
private static final String DEFAULT_SHAPE = "box";
private static final String DEFAULT_STYLE = "filled";
Expand Down Expand Up @@ -442,13 +442,24 @@ private static String getConf(
}

/**
* Generates a dot file for the CPU profiling events available in the recording.
* Generates a DOT file for the execution sample (CPU profiling) events available in the
* recording.
* <p>
* TODO: This could easily be made highly configurable to allow the user to configure which
* event type to filter for, what attribute to use for weight, and what frame separator to use.
*
* @param args
* takes one argument - the file name of the JFR file to serialize into DOT.
* @throws IOException
* @throws CouldNotLoadRecordingException
*/
public static void main(String[] args) throws IOException, CouldNotLoadRecordingException {
if (args.length != 1) {
System.out.println("Usage: DotSerializer <filename>\n");
System.out.println(
"Serializes the execution sample events in a JFR file into a DOT file, suitable for visualizing with GraphViz.");
System.exit(2);
}
File jfrFile = new File(args[0]);
IItemCollection items = JfrLoaderToolkit.loadEvents(jfrFile);
IItemCollection filteredItems = items.apply(JdkFilters.EXECUTION_SAMPLE);
Expand Down
Loading

0 comments on commit 8c28f1b

Please sign in to comment.