性能分析

  1. 利用valgrind工具

1)  下载valgrind

2)  利用参数启动程序

Valgrind --tool=callgrind <程序的启动命令>

3)  执行操作需要正常退出,或者kill -6/kill -9

4)  执行操作会生成文件callgrind.out.xxxx,里面包含了性能数据

5)  利用图形查看工具分析

qcachegrind074-32bit-x86

https://sourceforge.net/projects/qcachegrindwin/

 

2. 利用gprof功能

1)在make文件里添加-pg标志,重新编译包

2)运行程序,会生成gmon.out文件

3)通过分析gmon.out文件,获得性能问题

 

3. 通过分析sar分析,发现性能问题

参考http://www.thegeekstuff.com/2011/03/sar-examples/

1) 安装sar工具

YaST –i sysstat

sudo apt-get install systat

yum install sysstat

rpm –ivh systat-10.0.0-1.i586.rpm

http://sebastien.godard.pagesperso-orange.fr/download.html

2) 生成分析数据

Nohup bash –c “LANG=c sar –n ALL 10 1000000” >> 1.txt 2>&1 </dev/null&

3)利用图形化工具查看

 https://sourceforge.net/projects/ksar/files/

http://www.unixarena.com/2013/04/ksar-graphical-sar-analysis-tool.html

 

posted on 2017-02-05 21:20  随性随行  阅读(134)  评论(0编辑  收藏  举报