1、安装valgrind
2、下载graphvis,并安装
3、下载gprof2dot.py文件
4、g++ -g -pg -o test test.cpp编译二进制文件
方式一:
5、执行test 就会生成一个gmon.out文件
6、gprof ./test |./gprof2dot.py -n0 -e0 -s |dot -Tsvg -o output_1c.svg 生成svg文件
方式二:
valgrind --tool=callgrind ./test
./gprof2dot.py -n0 -e0 -s -w -f callgrind callgrind.out.32064 |dot -Tsvg -o report.svg
或者直接查看 callgrind_annotate callgrind.out.32064
可以 gprof2dot -n0 -e0 ,默认是n0.5即影响小于5%的函数就不显示了。
2、下载graphvis,并安装
3、下载gprof2dot.py文件
4、g++ -g -pg -o test test.cpp编译二进制文件
方式一:
5、执行test 就会生成一个gmon.out文件
6、gprof ./test |./gprof2dot.py -n0 -e0 -s |dot -Tsvg -o output_1c.svg 生成svg文件
方式二:
valgrind --tool=callgrind ./test
./gprof2dot.py -n0 -e0 -s -w -f callgrind callgrind.out.32064 |dot -Tsvg -o report.svg
或者直接查看 callgrind_annotate callgrind.out.32064
可以 gprof2dot -n0 -e0 ,默认是n0.5即影响小于5%的函数就不显示了。
可以 gprof2dot -n0 -e0 -s #-s表示不显示诸如模板,函数入口参数等等,使得函数名称显示更加精简。