1

I am new to perf,

try to understand the result, but how to read something like this?

 39.57%  TestSoft.exe  libc-2.15.so         [.] 0x3fd59
  7.04%  TestSoft.exe  libc-2.15.so         [.] malloc
  6.15%  TestSoft.exe  LoanSoft.exe         [.] LoanDef::update_vec()

the first line might be some function in libc, but which function was it? what does that 0x3fd59 mean? also, for second line, which function in my code calls malloc? for the third line, can I further make perf on that function only to see which part of update_vec() was slow?

Thanks a lot!

bbc
  • 1,061
  • 4
  • 13
  • 21

2 Answers2

2

You need to build with debug symbols (-g option passed to g++ when compiling). Then you will be able to see which function uses that CPU time. You also need to use libraries with debug symbols.

BЈовић
  • 62,405
  • 41
  • 173
  • 273
  • thank you, so I will use -g for g++? or just make -d ? how do I use debug-version of libraries? – bbc Aug 18 '12 at 20:03
  • 1
    @bbc [This question and answers](http://stackoverflow.com/questions/10000335/how-to-use-debug-version-of-libc) talks how to use debug version of libraries – BЈовић Aug 18 '12 at 20:05
  • @bbc Not sure if `make -d` would work. That depends on your makefile – BЈовић Aug 18 '12 at 20:06
  • first item breaks in to 11.54% TestSoft.exe libc-2.15.so [.] _int_malloc 11.52% TestSoft.exe libc-2.15.so [.] _int_free is this the best perf can give? – bbc Aug 18 '12 at 20:57
  • @bbc I think so. You can also use [callgrind](http://valgrind.org/docs/manual/cl-manual.html) and it's [GUI](http://kcachegrind.sourceforge.net/html/Home.html) – BЈовић Aug 19 '12 at 11:27
2

Since the dump is of all the functions from user mode, its suggested to compile with debug symbols.0x3fd59 is a routine whose actual name is not available due to missing symbol.
See here to do your analysis at Source level.

 39.57%  TestSoft.exe  libc-2.15.so         [.] 0x3fd59
  7.04%  TestSoft.exe  libc-2.15.so         [.] malloc
  6.15%  TestSoft.exe  LoanSoft.exe         [.] LoanDef::update_vec()

First indicates the percentage of the overall samples collected in the corresponding function.

The second column reports the process from which the samples were collected.

The third column shows the name of the ELF image where the samples came from. If a program is dynamically linked, then this may show the name of a shared library. When the samples come from the kernel, then the pseudo ELF image name [kernel.kallsyms] is used.

The fourth column indicates the privilege level at which the sample was taken, i.e. when the program was running when it was interrupted:

   [.] : user level
   [k]: kernel level
   [g]: guest kernel level (virtualization)
   [u]: guest os user space
   [H]: hypervisor

The final column shows the symbol name.

perilbrain
  • 7,961
  • 2
  • 27
  • 35