Skip to content

Latest commit

 

History

History
36 lines (19 loc) · 615 Bytes

profiling.md

File metadata and controls

36 lines (19 loc) · 615 Bytes

性能分析工具

valgrind

calgrind

valgrind --tool=callgrind ./test

多线程 valgrind --tool=callgrind --separate-threads=yes ./test

mac 安装qcachegrind

brew install qcachegrind

https://wizardforcel.gitbooks.io/lcthw/content/ex41.html

非侵入式 : top / pstack / strace / perf

top M 查看内存 P 查看 CPU

pstack 查看进程调用栈情况

strace 显示出进程正在运行的系统调用

perf top -K -p xxx CPU排序,找出最耗费CPU的函数

pstree 查看线程

侵入式 : gperftools

apt-get install google-perftools
apt-get install libgoogle-perftools-dev