【问题标题】:how to use gprof together with autotools?如何将 gprof 与 autotools 一起使用?
【发布时间】:2013-09-17 00:30:34
【问题描述】:

我一直在使用 Auto-tools(C++ 是语言)编写一个小型开源软件,并生成/安装了一个执行程序。使用了一些蒙特卡洛积分,代码很慢。我想用gprof来改进,想问一下如何启用gprof呢? 我努力了: ./configure CFLAGS=-pg​​ && make && sudo make install 这不起作用。

【问题讨论】:

  • 怎么不工作?

标签: c++ autotools gprof


【解决方案1】:

您需要 CXXFLAGS,而不是 CFLAGS,因为您使用的是 C++。

【讨论】:

  • 非常感谢。我也使用了 CXXFLAGS=-pg​​。在 configure、make、make install 和运行代码之后,会生成一个名为 gmon.out 的输出文件,但我认为这不是正确的格式:itkp.uni-bonn.de/~weiwang/gmon.out
  • 我没有点击链接,但是您可以使用 gprof 工具将 gmon.out 转换为可读格式。
  • 我试过:gprof gmon.out 但得到错误:gprof: gmon.out: not in executable format
  • @weiwang 您必须将可执行文件名放在 gmon 文件之前。 gprof a.out gmon.out
猜你喜欢
  • 2010-10-29
  • 1970-01-01
  • 2011-02-26
  • 2016-02-18
  • 2021-01-02
  • 1970-01-01
  • 2023-03-13
  • 2014-09-25
  • 2016-01-30
相关资源
最近更新 更多