gperftools 分析应用程序性能

本文介绍了如何利用gperftools进行应用程序性能分析,包括安装libunwind和google-perftools,修改tomcat启动文件以加载工具,并解析性能分析日志,找出程序瓶颈。
摘要由CSDN通过智能技术生成

gperftools是Google提供的一套工具,其中的一个功能是CPU profiler,用于分析程序性能,找到程序的性能瓶颈。

1.安装libunwind库

可以从http://download.savannah.gnu.org/releases/libunwind下载相应的libunwind版本,这里下载的是libunwind-0.99-beta.tar.gz,安装过程如下

[root@localhost home]#tar zxvf libunwind-0.99-beta.tar.gz
[root@localhost home]# cd libunwind-0.99-beta/
[root@localhost libunwind-0.99-beta]#./configure
[root@localhost libunwind-0.99-beta]#make
[root@localhost libunwind-0.99-beta]#make install
[root@localhost libunwind-0.99-beta]#make clean

2.安装google-perftools

可以从https://github.com/gperftools/gperftools下载相应的google-perftools版本,这里下载的是google-perftools-2.5.tar.gz,安装过程如下:

[root@localhost home]# tar zxvf google-perftools-2.5.tar.gz
[root@localhost home]# cd google-perftools-2.5/
[root@localhost google-perftools-2.5]# ./configure
[root@localhost google-perftools-2.5]# make
[root@localhost google-perftools-2.5]# make install
[root@localhost google-perftools-2.5]# make clean
[root@localhost google-perftools-2.5]# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
[root@localhost google-perftools-2.5]# ldconfig

至此,google-perftools安装完成。

3.为google-perftools添加线程目录

创建一个线程目录,这里将文件放在/tmp/tcmalloc下,操作如下:

[root@localhost home]#mkdir /tmp/tcmalloc
[root@localhost home]#chmod 0777 /tmp/tcmalloc

4.修改tomcat启动文件startup.sh

加入export LD_PRELOAD=/usr/local/l
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值