1. sudo perf top
在另外一个terminal 跑你的程序, sudo perf top 列出专用资源的情况
2. valgrind --tool=callgrind --trace-children=yes --instr-atstart=no ./src/tpcc -k 0.1 -b 1 -x occ -g co -d 20 -w 1 -z hash -o -l -c
然后用kcachegrind callgrind.out.6068 查看结果
You can see the inclusive and the self cost of each function and the location of each one. 就是说incl是这个function+其调用的其他function 一共占用的CPU,self是该function自己占用的CPU