FlameViewer
Install Plugin
- Standalone command-line tool FlameViewer-1.0.jar
java -jar FlameViewer-1.0.jar path/to/my_app.jfr
- Plugin for JetBrains IDEs: https://plugins.jetbrains.com/plugin/10305-flameviewer
Table of contents
- Uploading file to FlameViewer
- Java performance recording. Quick start
- FlameViewer Features
- Building from sources
Uploading file to FlameViewer
- Click Tools | Open FlameViewer...
- Upload a file of a supported profiler:
- jfr files generated by Flight Recorder
- 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
- Files in flamegraph format
- fierix files generated by Fierix profiler
Java performance recording. Quick start
Use Flight Recorder to profile your program and then open FlameViewer:
- Make sure 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 - Run JVM with following VM options:
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=30s,filename=my_recording.jfr -XX:FlightRecorderOptions=stackdepth=256
- Open FlameViewer Tools | Open FlameViewer...
- Upload my_recording.jfr
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
Regexp for filtering method calls e.g. my\.package.*|another\.package.*
.
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.
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).
Building from sources
If only want to use plugin then you should simply install ready-to-use jar.
./gradlew :visualization:copyStatic
./gradlew :intellij-plugin:runIdea
Regenerate flatbuffers
cflamegraph_schema.fbs has to be regenerated after flatbuffers compiler and flatbuffers runtime library are updated.
chmod +x ./scripts/install-flatbuffers.sh
./scripts/install-flatbuffers.sh
./gradlew :core:compileFlatBuffers