google-perftools

Line number in Google Perftools CPU profiler on MacOSX

我的梦境 提交于 2019-12-02 18:26:54
I am trying to profile some C++ programs on MacOSX. So I built google-perftools , wrote a program, compiled using MacPorts g++ 4.7, with -g compiler flag, and linked to libprofiler . Then I ran: CPUPROFILE=cpu.profile ./a.out Then I ran pprof to generate the output: [hidden ~]$ pprof --text ./a.out cpu.profile Using local file ./a.out. Using local file cpu.profile. Removing __sigtramp from all stack traces. Total: 282 samples 107 37.9% 37.9% 107 37.9% 0x000000010d72229e 16 5.7% 43.6% 16 5.7% 0x000000010d721a5f 12 4.3% 47.9% 12 4.3% 0x000000010d721de8 11 3.9% 51.8% 11 3.9% 0x000000010d721a4e 9

Is my using gperftools to profile a R script with RCpp correct?

爷,独闯天下 提交于 2019-12-02 10:53:04
问题 I am trying to profile a R script with the last (third) approach in http://pj.freefaculty.org/blog/?p=140. I wonder if what I do (described in the following) is correct? Firstly, in my.cpp , the link says to add #include <gperftools/profiler.h> , which doesn't work for me. I found that the header is located in a different dir, and what works for me is #include <google/profiler.h> . Then I put the following around some code to be profiled ProfilerStart("./myprofile.log") //the part of the code