Skip to content

Get Method Sampling from Java Flight Recorder Dump and convert to FlameGraph compatible format.

License

Notifications You must be signed in to change notification settings

bltb/jfr-flame-graph

 
 

Repository files navigation

Build Status

Converting JFR Method Profiling Samples to FlameGraph compatible format.

This is a simple application to read Method Profiling Samples from Java Flight Recorder dump and convert those Stack Traces to [FlameGraph] compatible format. [FlameGraph]: https://github.com/brendangregg/FlameGraph

This application uses the unsupported [JMC Parser]. [JMC Parser]: http://hirt.se/blog/?p=446

See my blog post on "Flame Graphs with Java Flight Recordings" for more details.

How to build

Step 1:

Run install-mc-jars.sh script.

The required JMC dependencies need to be installed to a local repository first. The script will install required JMC jars to the local repository (The repo directory) and output a file named jmc_version.properties, which will show you the version of Java Mission Control Dependencies used. This script should automatically update the <jmc.version> property in pom.xml. Please verify that the <jmc.version> value is equal to the version found in jmc_version.properties.

Step 2:

Run mvn clean install -U.

How to run

After building, you can just run the JAR file. There is a helper script named flamegraph-output.sh to run the jar file.

For example:

./flamegraph-output.sh folded -f /tmp/highcpu.jfr -o /tmp/output.txt

Following are the options available.

$ ./flamegraph-output.sh -h
Usage: Application [options] [command] [command options]
  Options:
    -h, --help
      Display Help
      Default: false
  Commands:
    folded      Create folded output
      Usage: folded [options]
        Options:
          -d, --decompress
            Decompress the JFR file
            Default: false
          -i, --ignore-line-numbers
            Ignore Line Numbers in Stack Frame
            Default: false
        * -f, --jfrdump
            Java Flight Recorder Dump
          -o, --output
            Output file

    json      Create json output for d3-flame-graph
      Usage: json [options]
        Options:
          -d, --decompress
            Decompress the JFR file
            Default: false
          -i, --ignore-line-numbers
            Ignore Line Numbers in Stack Frame
            Default: false
        * -f, --jfrdump
            Java Flight Recorder Dump
          -l, --live
            Export stack trace sample timestamp
            Default: false
          -o, --output
            Output file

How to generate a Flame Graph

Clone Brendan's [FlameGraph] repository, generate FlameGraph using flamegraph.pl and open the SVG file in your web browser.

git clone https://github.com/brendangregg/FlameGraph.git
cd FlameGraph
cat /tmp/output.txt | ./flamegraph.pl > ../traces-highcpu.svg
firefox ../traces-highcpu.svg

License

Copyright (C) 2015 M. Isuru Tharanga Chrishantha Perera

Licensed under the Apache License, Version 2.0

About

Get Method Sampling from Java Flight Recorder Dump and convert to FlameGraph compatible format.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 73.4%
  • Shell 26.6%