简体   繁体   中英

Call stack in the perf profiler

I'm running "perf" in the following way:

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

perf report --call-graph --stdio

Then, I see this:

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

I can't see which functions call my_func(). I see "nil" and "0x17f310000000a" instead. Am I doing something wrong? It is probably not a debug info problem because some symbols are shown while others are not shown.

More info:

  • I'm runnning CentOS 6.2 (kernel 2.6.32-220.4.1).
  • perf rpm - perf-2.6.32-279.5.2.el6.x86_64.

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

You're almost there, you're missing the -G option (you might need a more recent perf than the one installed on your system):

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

From perf help report :

   -G, --inverted
       alias for inverted caller based call graph.

Have you tried profiling with Zoom ? It can use perf, a custom driver, or oprofile to collect samples. If you're just interested in looking at one process, try the "Thread Time" configuration.

I'd be interested to know if any of Zoom's options are better/different at getting the function information than stand-alone perf.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM