-
Notifications
You must be signed in to change notification settings - Fork 113
Profiling Linux Builds with Perf
If you want to profile spring-dedicated, while it is running, there is one good way of doing so, using linux perf tools, which can be installed on most ubuntu/debian based systems easily.
Find out the PID of the spring-dedicated process you wish to attach to. The process seems to have two threads, with approximately equal shares of CPU usage. Find it with
ps aux | grep spring
Remember the process ID of the main thread (generally the smaller one)
- Create a working directory for where you will store your captures.
- Download the debug symbols from the releases page here on github (take care to select linux, and the correct version too).
- Unpack the debug symbols, and make sure the symbols (e.g. spring-dedicated.dbg) are unzipped into your working directory.
Often you will need sudo permissions to perform this capture. perf will warn you otherwise.
Example command:
sudo perf record --pid=3140530 --freq=1000 -o spring-dedicated_6cg_lag1.perfoutput -g --call-graph dwarf
Arguments:
- --pid= the process id for spring-dedicated
- --freq= the number of samples per second to take
- -o the name of the output file, if you dont name it, it will overwrite previous captures
- -g enable call graphs
- --call-graph dwarf : the format of the call graphs. I am unsure if 'fp' or 'dwarf' is the correct argument here.
Press CTRL+C to stop the profiler, or send it a SIGTERM signal from code, if you are doing this automatically
sudo perf report -i spring-dedicated_6cg_lag1.perfoutput
Use the '+' key on your keyboard to expand call graphs within perf