profiling - 如何使用 callgrind 仅分析特定时间段的程序执行?

标签 profiling valgrind callgrind

我想使用 valgrind 进行一些分析,因为它不需要重新构建程序。 (我想分析的程序已经用“-g”构建了)

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

  • 启动服务器(我想分析该服务器)
  • 一种附加到该服务器
  • 在我对服务器做一些操作之前,开始收集配置文件数据
  • 操作完成后,结束采集profile数据
  • 分析剖析数据。

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

    谢谢

    最佳答案

    你应该看看callgrind documentation ,并阅读有关 callgrind_control 的信息。

  • 启动您的应用程序:valgrind --tool=callgrind --instr-atstart=no your_server.x
  • 见1。
  • 开始收集个人资料数据:callgrind_control -i on
  • 结束收集个人资料数据:callgrind_control -i off
  • 使用 分析数据kcachegrind callgrind_annotate/cg_annotate
  • 关于profiling - 如何使用 callgrind 仅分析特定时间段的程序执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2400025/

    相关文章:

    c - 寻找内存块

    c++ - 使用 MPI 进行 Valgrind+gdb 调试,库中出现错误?

    c++ - Callgrind 内联函数

    cuda - 如何在 Linux 中使用 NVIDIA Nsight 分析 PyCUDA 代码?

    java - 记录/重放 Java 方法调用的工具

    c - Helgrind 报告单线程上的数据争用

    c++ - 相当于 gprof/callgrind 的分析库

    c++ - Kcachegrind。仅显示我的代码中的函数

    javascript - 页面事件上慢 javascript (jquery) 的分析器? "Unresponsive Script"错误

    macos - 使用 DTrace 在 Rust 上获取堆栈跟踪/分析数据