-
1. Re: Exporting Thread Dumps From Java Flight Recording
Klara Ward, Java Mission Control Dev-Oracle Mar 16, 2015 12:54 PM (in response to andy dufresne)1 person found this helpfulYou could parse your recording using either the reference parser in the JDK, or the parser we use in JMC: Using the Flight Recorder Parsers | Marcus Hirt
You could also call the JDK reference parser from commandline:
java oracle.jrockit.jfr.parser.Parser -xml c:/myrecording > c:/myrecording.xml
Notice that the resulting xml file is quite large.
-
2. Re: Re: Exporting Thread Dumps From Java Flight Recording
andy dufresne Mar 17, 2015 7:56 AM (in response to Klara Ward, Java Mission Control Dev-Oracle)Thanks for the reply.
I tried following the code on the blog post, but since the blog post is quite old (2013) most of the classes are now deprecated
recordingFile = new File("E:\\flight_recording_2015-02-04_15_29_48.jfr"); try { Parser parser = new Parser(recordingFile); int count = 0; Iterator<ChunkParser> chunkIter = parser.iterator(); while (chunkIter.hasNext()) { ChunkParser chunkParser = chunkIter.next(); for (FLREvent event : chunkParser) { count++; System.out.println(event.toString()); } } System.out.println("Found " + count + " events"); } catch (IOException e) { e.printStackTrace(); }
Is the source code on github or somewhere, so that I found out the right classes to be used?
-
3. Re: Re: Exporting Thread Dumps From Java Flight Recording
Klara Ward, Java Mission Control Dev-Oracle Mar 17, 2015 8:46 AM (in response to andy dufresne)This is in the closed part of the Oracle JDK, I can try to find out what needs to be changed.
-
4. Re: Re: Exporting Thread Dumps From Java Flight Recording
andy dufresne Mar 17, 2015 10:34 AM (in response to Klara Ward, Java Mission Control Dev-Oracle)Ok. That would be great. I am currently using jdk 1.8 update 31.
-
5. Re: Re: Re: Exporting Thread Dumps From Java Flight Recording
Klara Ward, Java Mission Control Dev-Oracle Mar 18, 2015 8:47 AM (in response to andy dufresne)These classes have been deprecated from the start in the Oracle JDK (it's the old JRockit APIs, we are working on new and supported APIs for a later release)
There is an access restriction on the jfr.jar, so if you run from within Eclipse for instance, you need to add something like the following to your .classpath
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<accessrules>
<accessrule kind="accessible" pattern="oracle/jrockit/jfr/parser/**"/>
</accessrules>
</classpathentry>
From commandline there is no problem combiling the code with javac.
-
6. Re: Re: Exporting Thread Dumps From Java Flight Recording
andy dufresne Mar 19, 2015 9:50 AM (in response to Klara Ward, Java Mission Control Dev-Oracle)Ok. The deprecated api's probably won't give wrong output.
The access restriction is not an issue since I execute my code through Intellij.
When is the new api planned for release ? JMC 6.0 (i.e. JDK 1.9) ?
-
7. Re: Re: Exporting Thread Dumps From Java Flight Recording
Hirt-Oracle Mar 19, 2015 11:45 AM (in response to andy dufresne)Yep. JMC 6.0.0 & JDK 9.