build with -fno-omit-frame-pointer
.
-g
to collect stack information.
perf record -g
perf stat report
graph
: percentage
perf report -g 'graph,0.5,caller'
svgs := $(patsubst data/%.data, svg/%.svg, $(wildcard data/*data))
all : $(svgs)
%.folded : data/%.data
perf script -i $< | stackcollapse-perf.pl > $@
svg/%.svg : %.folded
flamegraph.pl $< > $@
$ python -m cProfile -o prof.out foo.py
$ gprof2dot -f pstats prof.out | dot -Tpng -o prof.png