java -jar FlameViewer-1.0.jar path/to/my_app.jfr
java -jar -Dexport.call.tree.cpu -Dexport.csv /lib/yjp.jar -export ~/Snapshots/.snapshot
Use Flight Recorder to profile your program and then open FlameViewer:
.../jdk1.8.0_162
not like this: .../java-8-openjdk-amd64
. You can download needed version from Oracle website: JDK 8, JDK 9-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=30s,filename=my_recording.jfr -XX:FlightRecorderOptions=stackdepth=256
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.
Regexp for filtering method calls e.g. my\.package.*|another\.package.*
.
You can find any method, class or package using search.
Tips:
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 only want to use plugin then you should simply install ready-to-use jar.
./gradlew :visualization:copyStatic
./gradlew :intellij-plugin:runIdea
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