使用google perftools进行cpu占用分析
来源:互联网 发布:python编程求圆的面积 编辑:程序博客网 时间:2024/06/06 17:16
一. 安装
1. 包下载路径:
http://code.google.com/p/google-perftools/downloads/list
2. 安装:
解压;
./configure;
Make & make install
注意:如果make报错,使用./configure --enable-frame-pointers。
二. 使用
1. 代码中添加信号处理函数,当接收到SIGUSR1信号时,开始采样,
ProfileStart(”/home/profile.prof”);
2. 代码中添加信号处理函数,当接收到SIGUSR2信号时,结束采样,
ProfileStop();
3. 当程序运行时,使用kill–s SIGUSR1 PID实现采样开启,同样使用
Kill –s SIGUSR2 PID 实现采样关闭。
三,结果分析
1. 使用结束后会生成ProfileStart中指定的文件;
2. 可以通过 pprof --text ./RBtree ./RBtree.prof 查看cpu占用情况,然后可针对占用较高的部分进行优化。
3. 可以通过pprof –pdf./RBtree ./RBtree.prof >test.pdf,这样可以查看调用关系;
注意:生成pdf等分析格式时,会提示dot未找到之类的,安装graphviz即可解决。
阅读全文
0 0
- 使用google perftools进行cpu占用分析
- [C++]google perftools分析程序CPU / 内存的使用
- google-perftools简明使用
- google perftools分析程序性能
- google perftools分析程序性能
- google perftools分析程序性能
- google perftools分析程序性能
- google perftools分析程序性能
- 使用Google PerfTools 优化Nginx
- Google Perftools简介与使用
- Google Perftools简介与使用
- 安装和使用Google perftools
- Google Perftools简介与使用
- Google Perftools简介与使用
- google-perftools分析程序瓶颈(最耗cpu的代码块)
- google-perftools 分析JAVA 堆外内存
- google-perftools
- google perftools
- 代码干货 | 嵌入式开发C语言位结构体用途详解
- mybatis like查询常用两种写法
- 表单验证
- 正则表达式随机采集页面上面的六位数
- CSS:hack
- 使用google perftools进行cpu占用分析
- mybatis中模糊查询的写法
- error: redefinition of
- Linux学习笔记:bash的算术运算及条件测试
- Spring事件 Event 为bean与bean之间的消息通信提供支持
- django搭建个人博客遇到的常见问题
- 跨数据库分布式实时事务
- SpringCloudConfig相关配置
- java8新特性