Sunday 15 August 2010

c++ - How to get a callstack from oprofile output? -


I am very confused I do not know that oprofile can also provide a stack trace from a profiling report I have oprofile manual I am reviewing and it only refers to stackets by saying, but it does not give an example to do this.

Here is my test.cpp

>  #include & lt; Iostream & gt; # Include & lt; Unistd.h & gt; using namespace std; Zero test (for (int x = 0; x <100000; x ++) cout   

here The order used to compile it is:

  G ++ -G-wall test.cpp -o test   

And, here my perf The .sh script is running (running VH 6.2 on RHEL):

  #! / Bin / bash -x sudo opcontrol --no-vmlinux sudo opcontrol - Sudo opcontrol --start - Separate = library, thread --image = $ HOME / test sudo opcontrol --callgraph = 10 sudo opcontrol --status read -p Press [Enter] key to stop profiling "sudo opcon Trol - dump || exit 1 pseudo operaport - demangle = smart \ --mirge = all \ --symbols \ --callgraph \ --global-percent \ --output-file = perf.out pseudo opcontrol --shutdown pseudo Opcontrol --reset   

I am currently receiving the report:

  CPU: with CPU timer interrupt, Speed ​​0 MHz (approximate) timer Profiling Interrupt Samples by% App Name Symbol Name ---------------------------------------- ---- ----------------------------------- 14 43.7500 libstdc ++.6.6.1.13 / usr / Lib64 / libstdc ++ .so.6.0.13 14 43.7500 libstdc ++.6.6.0.13 / User / Lib 64 / LIBSTDC ++ ..6.6.1.13 [Self] -------------------- ----------------- --------------------------------- --------- 11 34.3750 libc.2.12.so trust 11 34.3750 libc.2.12.so fwrite [self] ---------------------- ----------------- --------------------------------- ------- 5 15.6250 libc.2.12.so _IO_file_xsputn @@ GLIBC_2.2.5 5 15.6250 libc.2.12.so _IO_file_xsputn @@GLIBC_2.2.5 [self] -------------- ----------------- --------------------------------- ------------ --- 2 6.2500 Libc.2.12.so __strlen_sse42 2 6.2500 libc.2.12.so __strlen_sse42 [self] --------------------------------- --------------------------------------------- -   

And, my question: How do I get a stack trace to show in the profiling report?

(this is a bit late, but it can help someone else)

Because you are profiling in timer mode (which is the default behavior on some CPUs), backstring may be disabled in your kernel (which is version 2.6 You can try:

    Use hardware counters

    Li> Look at the kernel part of the oprofile, if Your kernel has a limit on the

    I had to face the same problem with the same kernel release, but since I am at ARM, my Accelerated - will not work properly (in this case there is a patches to apply).

No comments:

Post a Comment