admin管理员组文章数量:1642330
perf
性能瓶颈的位置,性能瓶颈的类型(cachemisses还是io密集型)
perf record -e cpu-clock -g ./run
To make the adjusted perf_event_paranoid setting permanent preserve it in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = )
临时设置,需要sudo su切换到root用户后再进行如下操作,操作完成后返回原用户
sudo su
echo -1 > /proc/sys/kernel/perf_event_paranoid
sudo su - religiousj
sudo perf report -i perf.data,可以看出main函数所占百分比,以及funcA和funcB…分别所占百分比
sudo perf report -i perf.data
转化成火焰图,可视化分析:
系统级性能分析工具perf的介绍与使用 - ArnoldLu - 博客园
perf-系统级性能分析工具 _
Gprof
g++ -std=c++11 -O3 SLIC.cpp -pg -o SLIC
./SLIC
gprof SLIC gmon.out > gprofresult.txt
SILC 为.exe文件 一般情况下用 test.exe
若图像形式输出
- python3
- gprof2dot和graphivz生成程序运行调用图
gprof2dot.py
https://pypi/project/gprof2dot/
graphivz
sudo apt install graphivz
方法:
python gprof2dot.py gprof_output.txt> call_graph.dot
dot -Tpng call_graph.dot -o call_graph.png
python gprof2dot.py gprofresult.txt> call_graph.dot
dot -Tpng call_graph.dot -o call_graph.png
使用gprof2dot和graphivz生成程序运行调用图
版权声明:本文标题:linux自带的热点分析 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729336862a1197096.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论