30

我正在通过以下方式运行“perf”:

perf record -a --call-graph -p some_pid

perf report --call-graph --stdio

然后,我看到了这个:

 1.60%     my_binary  my_binary                [.] my_func
           |
           --- my_func
              |          
              |--71.10%-- (nil)
              |          (nil)
              |          
               --28.90%-- 0x17f310000000a

我看不到哪些函数调用了 my_func()。我看到的是“nil”和“0x17f310000000a”。难道我做错了什么?这可能不是调试信息问题,因为显示了一些符号而未显示其他符号。

更多信息:

  • 我正在运行 CentOS 6.2(内核 2.6.32-220.4.1)。
  • perf rpm - perf-2.6.32-279.5.2.el6.x86_64。
4

2 回答 2

31

确保您使用-fno-omit-frame-pointer gcc选项编译了代码。

于 2012-11-15T12:59:43.467 回答
17

你快到了,你错过了这个-G选项(你可能需要比你系统上安装的更新的性能):

$ perf report --call-graph --stdio -G

来自perf help report

   -G, --inverted
       alias for inverted caller based call graph.
于 2012-12-13T16:59:54.323 回答