linux下分析C++中某个函数的每行代码运行时间的profiler

xibei123 2016-01-29 06:54:29
求问有没有linux下能够分析C++中某个函数的每行代码运行时间或占比的profiler?
搜到gprof -l,但是新的gcc编译器已经不支持了,
gcov貌似也只是统计每行代码的执行次数,没有统计运行时间。
...全文
463 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fefe82 2016-01-29
  • 打赏
  • 举报
回复
valgrind --tool=callgrind 可能得在加点别的参数,可以到指令。 http://valgrind.org/docs/manual/cl-manual.html
引用
--dump-line=<no|yes> [default: yes] This specifies that event counting should be performed at source line granularity. This allows source annotation for sources which are compiled with debug information (-g). --dump-instr=<no|yes> [default: no] This specifies that event counting should be performed at per-instruction granularity. This allows for assembly code annotation. Currently the results can only be displayed by KCachegrind.
xibei123 2016-01-29
  • 打赏
  • 举报
回复
引用 1 楼 fefe82 的回复:
valgrind --tool=callgrind 可能得在加点别的参数,可以到指令。 http://valgrind.org/docs/manual/cl-manual.html
引用
--dump-line=<no|yes> [default: yes] This specifies that event counting should be performed at source line granularity. This allows source annotation for sources which are compiled with debug information (-g). --dump-instr=<no|yes> [default: no] This specifies that event counting should be performed at per-instruction granularity. This allows for assembly code annotation. Currently the results can only be displayed by KCachegrind.
谢谢,但看描述似乎还是只得到每行的执行次数(event counting)?

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧