简体   繁体   中英

Perf Tool Linux - No Call-Graph

I am tring to use perf version 3.0.8 to profile my embedded system Linux kernel version 3.0.8 .

I cross-compiled tools/perf using zlib and elfutils.

In order to familiarize with this tool I am using a simple quicksort example compiled using -g option.

I run perf record -F 99 -g -- ./qsort (copied from the example) and then perf report --stdio to see my profile results.

This is a snapshot of the perf report -g --stdio output:

No kallsyms or vmlinux with build-id f41dfb5606beda1d75171db69f1e9466cb4868ba was found
[hi3518_dsu] with build id f41dfb5606beda1d75171db69f1e9466cb4868ba not found, continuing without symbols
No kallsyms or vmlinux with build-id a0f9a05faf6bcfb72282a03e048b47e8a8c0f2ec was found
[hi3518_tde] with build id a0f9a05faf6bcfb72282a03e048b47e8a8c0f2ec not found, continuing without symbols

# Events: 256  cpu-clock
    #
    # Overhead  Command      Shared Object                  Symbol
    # ........  .......  .................  ......................
    #
        96.88%    qsort  qsort              [.] partition
         0.78%    qsort  [kernel.kallsyms]  [k] __do_softirq
         0.39%    qsort  [kernel.kallsyms]  [k] __wake_up_sync_key
         0.39%    qsort  [kernel.kallsyms]  [k] get_page_from_freelist
         0.39%    qsort  [kernel.kallsyms]  [k] __memzero
         0.39%    qsort  [kernel.kallsyms]  [k] div_s64_rem
         0.39%    qsort  [hi3518_tde]       [k] 0x58
         0.39%    qsort  [hi3518_dsu]       [k] 0x8154

As you can see there is not call-trace at all. I am really interested to study in deep my system and without a call-trace these results are useless.

You might have some luck using the -fno-omit-frame-pointer flag while compiling the program you are trying to profile. I am also having issues making call graphs work with perf on an ARM embedded system.

I found a solution. Run perf --call-graph dwarf -- ./qsort Make sure you have compiled the program with dwarf debug symbols (-g, -ggdb, or -gdwarf flag). In addition, you might need to install debug symbols for any libraries you are using on your system. https://fedoraproject.org/wiki/StackTraces shows how to install debug symbol packages for Fedora.

If the perf command fails with --call-graph dwarf, you may need to compile perf with libunwind in addition to elfutils.

Probably my pref version is really old (or/and the kernel tool). I tried with another soc (with a newer kernel and perf tool) and the callstack works properly. However, even without this feature, I'm using this tool profitably.

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