.:: debugging ::. -------------------------------------------------------------------------------- # print syscalls of process with all threads (-f) of running process strace -f -p # only trace certain syscalls strace -f -p -e trace=open,socket # trace signals delivered to process strace -f -p -e signal # dump stack of process and all threads pstack # print file flags # +fg print file flag abbreviations lsof +fg -p # print process virt mem map # compared to /proc/<>/maps it shows the size of the mappings pmap # get supported events perf list ## show process stats perf stat -p perf stat -p -I # select events of interests perf stat -p -e cycles,faults,cache-misses,context-switches # -K hide kernel threads perf top -F 99 -p -K ## record measurement into db # -g uses 'fb' = frame-pointer as default method to collect backtraces # tell gcc to not optimize fp out -fno-omit-frame-pointer perf record -F 99 -p -g # use post processing and dwarf to collect backtraces perf record -F 99 -p --call-graph dwarf perf record -F 99 -p -e instructions,cpu-cycles,faults,cache-misses,context-switches ## report perf db # print to stdio perf report -n --stdio # use tui perf report -g graph,0.5,caller # flamegraph (https://github.com/brendangregg/FlameGraph) # record events of interest, eg page-faults perf stat -e page-faults -I 1000 -p 571 perf script | FlameGraph/stackcollapse-perf.pl > out.perf-folded FlameGraph/flamegraph.pl out.perf-folded > perf-trace.svg # print supported events ophelp operf -p opreport -c opreport -l -------------------------------------------------------------------------------- vim:sts=2:et:tw=80:cc=80:fo+=t:ft=help