pyflame入门

安装

yum install autoconf automake
git clone https://github.com/uber/pyflame
cd pyflame/
./autogen.sh
./configure (MacOS出错Pyflame only supports Linux hosts)
make && make install

https://github.com/brendangregg/FlameGraph获取flamegraph.pl

使用

Profile PID for 60 seconds, sampling every 100ms.
pyflame -s 60 -r 0.1 PID | flamegraph.pl > myprofile.svg

或者 Trace Mode
pyflame [regular pyflame options] -t command arg1 arg2...

样例

https://github.com/uber/pyflame

横条越长的部分,表示被采样到的次数越多,从下往上可以看到在每一层上的函数耗时分布。

Warn: pyflame 上采样到的部分是 CPU heavy的代码.
怎么理解?
比如 call 一个很慢的 rpc server, client 等待过程中,采集到的时间就是 IDLE.或者C扩展代码甚至进程本身就是IDLE. 等等状态,采集到的都是IDLE

资料

https://github.com/akatrevorjay/pyflame

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值