Hotspot Analysis Flame Graphs
Command Function
Collects stack information about CPU, CYCLES, LOCK, CACHE_MISSES, and ALLOC events at certain points of time, collects statistics on hotspot methods in the current JVM, and displays the information in a flame graph and an inverted flame graph.
Processes in a container cannot be collected on the container host. To do so, use the command line tool in the container.
Syntax
devkit java-perf hotspot [-p {pid}] [-d <DURATION> ] [-e {CPU,ALLOC,CYCLES,CACHE_MISSES,LOCK}] [-i <INTERVAL> | --interval=INTERVAL]
Parameter Description
|
Parameter |
Option |
Description |
|---|---|---|
|
-h/--help |
- |
Obtains help information. |
|
-d/--duration |
- |
Collection duration, which defaults to 20 seconds. The value ranges from 1 to 300 seconds. You can press Ctrl+C to stop the collection and start analysis. |
|
-i/--interval |
- |
Sampling interval, which defaults to 10 ms. The value ranges from 1 ms to 1000 ms. |
|
-o/--output |
- |
Report output directory. By default, reports are generated in the data subdirectory of the tool installation directory. |
|
-p/--pid |
- |
PID of the Java process for which hotspot methods are collected. |
|
-e/--event |
CPU/ALLOC/CYCLES/CACHE_MISSES/LOCK |
Sampling event type, which defaults to CPU.
|
Example
devkit java-perf hotspot -p 17329 -e CPU -d 60 -i 10 -o /opt
The -p parameter specifies the ID of the process to be collected. The -e CPU parameter collects CPU event data. The -d 60 parameter specifies the collection duration of 60 seconds. The -i 10 parameter specifies the sampling interval of 10 ms. The -o /opt parameter specifies the report output directory of /opt.
Command output:
JAVA HOTSPOT ANALYSIS(Press Ctrl+C to exit and generate the summary report) The flame graph is generated in /opt/FlameGraph_CPU(31819)_20240612_104433.html.
You can view the generated flame graph HTML file using your browser. Data retrieval and inverted flame graphs are supported.
- An inverted flame graph starts from the top of the stack and gradually traces back to the bottom of the stack. It aggregates the call stacks that have the same call method.
- You can display the flame graph as needed: Click
to flip the flame graph up and down. Click
to restore the flame graph to its initial state; click
to sort the flame graph data by function proportion (which is the default sorting method); click
to sort the flame graph data by function name.