Flamegraph Viewer & Instrumentation Java Profiler Fierix
https://plugins.jetbrains.com/plugin/10305-flameviewer
- Uploading file to FlameViewer
- Java performance recording. Quick start
- Fierix (only IntelliJ IDEA)
- FlameViewer Features
- Contribution
- Building from sources
- 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 bundled Fierix profiler (IntelliJ IDEA only)
Use Flight Recorder to profile your program and then open FlameViewer:
- 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 - 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
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.
- 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'.
- To run program with profiler select the desired run configuration and choose Run with profiler
- 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.
- 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.*(*)
- 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).
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.
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 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.
Click on a rectangle to zoom in on it.
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.
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
On Hot Spots page you can see where your program spent the most time.
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.
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).
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
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