gprof工具简介
gprof为gnu profiler,用于分析程序性能信息文件,从中得到程序中的函数调用栈及被调函数耗时(也支持统计语句级别的耗时),指出程序中耗时的部分所在,辅助进行程序性能优化
gprof用户手册
Profiling has several steps:
- You must compile and link your program with profiling enabled. See Compiling.
- You must execute your program to generate a profile data file. See Executing.
- You must run
gprofto analyze the profile data. See Invoking.
使用方式概述
-
使用gprof分析程序性能时,编译程序需要增加编译和链接选项(-pg),具体可以见man手册说明

gprof是一款GNU的性能分析工具,用于分析程序的函数调用栈和耗时,帮助进行性能优化。使用时需在编译链接时添加-pg选项,运行后产生gmon.out文件,通过gprof工具分析。gprof2dot可将数据转换为图形化展示。但请注意,gprof不支持多线程程序的性能分析。
最低0.47元/天 解锁文章
3638

被折叠的 条评论
为什么被折叠?



