如何使用 callgrind 仅分析特定时间段的程序执行? [英] How use callgrind to profiling only a certain period of program execution?

查看:61
本文介绍了如何使用 callgrind 仅分析特定时间段的程序执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 valgrind 做一些分析,因为它不需要重新构建程序.(我想分析的程序已经用-g"构建了)

I want to use valgrind to do some profiling, since it does not need re-build the program. (the program I want to profile is already build with "-g")

但是 valgrind(callgrind) 很慢……所以我要做的是:

But valgrind(callgrind) is quite slow ... so here's what I to do:

  1. 启动服务器(我想分析该服务器)
  2. 某种附加到该服务器
  3. 在我对服务器进行一些操作之前,开始收集配置文件数据
  4. 操作完成后,结束收集个人资料数据
  5. 分析分析数据.

我可以在 Solaris 上使用 sun studio 做这种事情.(使用 dbx ).我只想知道是否可以使用 valgrind(callgrind) 做同样的事情?

I can do this kind of thing using sun studio on Solaris. (using dbx ). I just want to know is it possible to do the same thing using valgrind(callgrind)?

谢谢

推荐答案

你应该看看 callgrind 文档,并阅读有关 callgrind_control 的内容.

You should look at callgrind documentation, and read about callgrind_control.

  1. 启动您的应用程序:valgrind --tool=callgrind --instr-atstart=no your_server.x
  2. 见 1.
  3. 开始收集配置文件数据:callgrind_control -i on
  4. 结束收集个人资料数据:callgrind_control -i off
  5. 使用 kcachegrindcallgrind_annotate/cg_annotate
  6. 分析数据
  1. Launch your app : valgrind --tool=callgrind --instr-atstart=no your_server.x
  2. See 1.
  3. start collect profile data: callgrind_control -i on
  4. end collect profile data: callgrind_control -i off
  5. Analyze data with kcachegrind or callgrind_annotate/cg_annotate

这篇关于如何使用 callgrind 仅分析特定时间段的程序执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆