我是靠谱客的博主 昏睡世界,这篇文章主要介绍perf生成火焰图教程,现在分享给大家,希望可以做个参考。

perf是performance的简写,Perf是Linux kernel中的系统性能优化工具,perf基本原理的话是在CPU的PMU register中Get/Set performance counters来获得诸如instructions executed,cache-missed suffered,branches mispredicted等信息。

git clone https://github.com/brendangregg/FlameGraph.git
perf record -F 99 -p 30138 -g -- sleep 30
perf script | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/flamegraph.pl > perf.svg
sz perf.svg
sudo perf record -F 99 -p 30138 -g -- sleep 30
perf script | ../FlameGraph-master/stackcollapse-perf.pl | ../FlameGraph-master/flamegraph.pl > perf.svg
  • record 表示记录cpu的执行数据
  • -F:采样频率(次/秒)
  • -p:进程号
  • -g:输出调用栈数据
  • – sleep:本次采样总时长(秒)

参考文章
1、 如何读懂火焰图?
2、perf生成火焰图(无敌总结)

最后

以上就是昏睡世界最近收集整理的关于perf生成火焰图教程的全部内容,更多相关perf生成火焰图教程内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部