Arthas flame figure
1. Use
Using logic as, sampling begins — performing the action under test — sampling ends — analyzing
You can go inside arthas for use, or you can call scripts directly (-d specifies the sampling time, -e specifies the memory footprint, 3456 is the PID number)
profiler.sh -d 30 -e alloc -f profile.svg 3456
Copy the code
Sampling method
- Start, the default sampling information is CPU can be specified by –event
The supported analysis actions include CPU, memory, lock and other CPU, alloc, lock, and cache-misses
$ profiler start
Started [cpu] profiling
Copy the code
- Check the status
$ profiler status
[cpu] profiling is running for 4 seconds
Copy the code
- After sampling, you will see where the file is stored
profiler stop
Copy the code
- Simplify command
profiler start --duration 30 --file profile.svg --event alloc --d 306954
Copy the code
2. The analysis
In a fire diagram, the longer the bars, the more they are used, and from bottom to top is the call stack information
Wider means more calls and longer execution time, and higher means deeper call stack
The flame diagram is to see which function on the top takes up the most width. Any “flat top” (plateaus) indicates that the function may have a performance problem.
Support the operation
Click on the
Click on a layer to enlarge the flame horizontally. The layer takes up all width and displays detailed information. The upper left corner can be reset
suspension
Each layer of the flame will mark the function name, when the mouse hover shows the complete function name, sampling times, the percentage of total sampling times. Here’s an example
search
Pressing Ctrl + F displays a search box for functions directly, with re support
The instance
In the image above, the top-level function g() takes the most CPU time. D () has the largest width, but it consumes very little CPU directly. B () and C () do not consume CPU directly. Therefore, if you want to investigate performance issues, you should investigate G () first and I () second.
In addition, it can be seen from the figure that A () has two branches b() and H (), which indicates that there may be a conditional statement in A (), and the B () branch consumes much more CPU than H ().
3. Common commands
SVG -t 1786 # CPU./ profil. sh -d 10 -e CPU -f output-cpu --all-user 1786 # CPU./profiler.sh -d 10 -e hotMethod1 -f output-method. SVG --all-user 1786 # CPU./profiler.sh -d 10 -f output-cpu. SVG --all-user 1786 # clock signal./ profil. sh -d 10 -e wall -f output-wall List 1786 # help documentation./profiler.shCopy the code