Skip to content

Tool for Flame Graphs visualization and Java instrumentation profiler

License

Notifications You must be signed in to change notification settings

brtubb-patagonia/FlameViewer

 
 

Repository files navigation

FlameViewer

Flamegraph Viewer & Instrumentation Java Profiler Fierix

Build Status

Download Plugin

https://plugins.jetbrains.com/plugin/10305-flameviewer

Table of contents

Uploading file to FlameViewer

  1. Click Tools | Open FlameViewer...
  2. Upload a file of a supported profiler:
    1. jfr files generated by Flight Recorder
    2. Yourkit csv files. To generate csv file from a snapshot run following script: java -jar -Dexport.call.tree.cpu -Dexport.csv /lib/yjp.jar -export ~/Snapshots/.snapshot
    3. Files in flamegraph format
    4. fierix files generated by bundled Fierix profiler (IntelliJ IDEA only)

Java performance recording. Quick start

Use Flight Recorder to profile your program and then open FlameViewer:

  1. Make sure that you are using Oracle JDK (not OpenJDK) because Java Mission Control comes only with Oracle JDK. To do it open File | Project Structure... | Project then click Edit beside Project SDK, look at JDK home path it should be something like this: .../jdk1.8.0_162 not like this: .../java-8-openjdk-amd64. You can download needed version from Oracle website: JDK 8, JDK 9
  2. Run JVM with following VM options: -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=30s,filename=my_recording.jfr -XX:FlightRecorderOptions=stackdepth=256
  3. Open FlameViewer Tools | Open FlameViewer...
  4. Upload my_recording.jfr

Fierix (only IntelliJ IDEA)

Fierix is a bundled instrumentation Java profiler that allows to save parameters of method calls, specify what methods will be instrumented and view a call tree.

  1. To specify methods that will be recorded open Tools | Fierix | Edit Configuration...
    The configuration below tells profiler to record all methods from my.package.util and my.package.messages packages except methods that start with 'get' or 'set'.
  2. To run program with profiler select the desired run configuration and choose Run with profiler
  3. Also you can configure profiler to save value of method's parameters or it's return value. This should be done if you want to see how parameters influence method's performance. To enable this option check 'Save' checkbox beside type of parameter(s) when editing pattern in configuration.
  4. Methods of system classes are not recorded by default. You may include them if you specify full name of a system class in configuration. For example: java.io.FileOutputStream.*(*)
  5. To open results click Tools | Fierix | Open Results...

When your program finishes you will see following message:

Methods count: 42

If Method count: 0 it means that either configuration is incorrect or all methods took less than 1ms. To profile small quick methods use sampling profiler (see Quick Start).

FlameViewer Features

Flamegraph Visualizer helps you to analyze performance of Java program. It draws a flamegraph where x-axis represents time and y-axis shows stack depth.

Each rectangle represents a method. If a rectangle is wide it means that your program spent a lot of time executing this method and methods that were called within it.

Basically you are looking for rectangles that have a wide "roof" that does not have any other method calls. It means that your program spent a lot of time executing this method.

Call Traces

This flamegraph accumulates all stacktraces of profiled program. One rectangle represents one or multiple calls of method.

If you place the cursor on the method's rectangle you will see popup with detailed information about method.

If you click on call-traces/back-traces icon on a popup (blue icons at the top of popup) you will see call-traces/back-traces tree for the method (this tree accumulates information from all calls of the method).

Back Traces

Back Traces is the bottom-up tree. It shows methods that called the method on the top of flamegraph. This flamegraph may be helpful if you know that some method was called a lot of times and you want to know what is the reason for it.

Zoom

Click on a rectangle to zoom in on it.

Filtering

If you want to see method that are located in some particular package you can apply filter.

Wildcards are supported with * and multiple filters can be specified using the pipe | character.

Search

You can find any method, class or package using search.

Tips:

  • Character '*' matches any sequence of characters.
  • If profiler saved values of parameters, you may include them in search string. For example: resolve(*, *IdeaPlugin.xml

Hot Spots

On Hot Spots page you can see where your program spent the most time.

Call Tree

This page is only for .ser files
On Call Tree page you can see activity of all threads. To see what was happening inside particular thread you should click on it's name.
threads preview

Detailed View of Thread

This page is only for .ser files
On this page you can see what was happening inside some thread. All method calls have original order. Each rectangle represents only one method call.
You can see popup with detailed information about method if you place the cursor on the method (also there are parameters and return value if they were saved).

Contribution

If you would like to contribute please ping me on telegram @lkornilova, there are plenty of tasks to do :)

If you have a suggestions or found a bug open an issue

Building from sources

If only want to use plugin then you should simply install ready-to-use jar.

Windows:

.\gradlew.bat prepareStaticAndAgent
.\gradlew.bat runIdea

Linux:

./gradlew prepareStaticAndAgent
./gradlew runIdea

About

Tool for Flame Graphs visualization and Java instrumentation profiler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 53.3%
  • Kotlin 24.0%
  • JavaScript 16.3%
  • CSS 3.4%
  • HTML 3.0%