gperftools

gperftools and pprof do not print my function names. Need advice on how to fix this

徘徊边缘 提交于 2021-01-28 07:20:27
问题 I'm currently writing a game in C++ using SDL on Ubuntu. I recently multithreaded my engine, so I switched from profiling with valgrind/callgrind to gperftools. I have gotten it to work, but it will not print my own function names. Oddly enough, it recognizes SDL function names (I've seen the reverse happening on a few threads online; shared library functions not having their names found). kcachegrind Output I run my program, and the execute the following two commands in order to get this:

How to use google perf tools

隐身守侯 提交于 2020-03-17 05:21:07
问题 I just started using google performance tools ( google-perftools and libgoogle-perftools4 packages in ubuntu), I swear that I'm googling for around a day and I didn't find an answer!! The problem is that I do not get the result for ALL of my functions with CPU profiling. This is my code: #include "gperftools/profiler.h" #include <iostream> #include <math.h> using namespace std; void bar() { int a,b,c,d,j,k; a=0; int z=0; b = 1000; while(z < b) { while (a < b) { d = sin(a); c = cos(a); j = tan

gperftools - profile file not dumped

橙三吉。 提交于 2020-02-28 07:53:58
问题 I've configured and built gpreftools. however, I can't seem to find the generated profile file of my program to display it. I took the following actions: Adding the -lprofiler linker flag to my .pro , building the program and the flag is added correctly at the linking stage. QMAKE_LFLAGS += -lprofiler Running with: $ CPUPROFILE=/tmp/prof.out /path/to/executable Executing: $ pprof --gv /path/to/MyExe /tmp/prof.out Then I get the following: Failed to get profile: curl -s --max-time 90 'http://

gperftools - profile file not dumped

梦想与她 提交于 2020-02-28 07:52:48
问题 I've configured and built gpreftools. however, I can't seem to find the generated profile file of my program to display it. I took the following actions: Adding the -lprofiler linker flag to my .pro , building the program and the flag is added correctly at the linking stage. QMAKE_LFLAGS += -lprofiler Running with: $ CPUPROFILE=/tmp/prof.out /path/to/executable Executing: $ pprof --gv /path/to/MyExe /tmp/prof.out Then I get the following: Failed to get profile: curl -s --max-time 90 'http://

gperftools - profile file not dumped

我怕爱的太早我们不能终老 提交于 2020-02-28 07:52:08
问题 I've configured and built gpreftools. however, I can't seem to find the generated profile file of my program to display it. I took the following actions: Adding the -lprofiler linker flag to my .pro , building the program and the flag is added correctly at the linking stage. QMAKE_LFLAGS += -lprofiler Running with: $ CPUPROFILE=/tmp/prof.out /path/to/executable Executing: $ pprof --gv /path/to/MyExe /tmp/prof.out Then I get the following: Failed to get profile: curl -s --max-time 90 'http://

Performance bottleneck at _L_unlock_16

情到浓时终转凉″ 提交于 2019-12-25 00:37:23
问题 I am trying to use google perf tools CPU profiler for debugging performance issues on a multi-threaded program. With single thread it take 250 ms while 4 threads take around 900ms. My program has a mmap'ed file which is shared across threads and all operations are read only. Also my program creates large number of objects which are not shared across threads. (Specifically my program uses CRF++ library to do some querying). I am trying to figure out how to make my program perform better with

Profiling timer expired when using gperftools with sort

好久不见. 提交于 2019-12-12 04:24:39
问题 I spent the whole day trying to make gperftools working :/ I tired different libunwind versions but when I successed in installing it I got the following error "Profiling timer expired" whenever I used std::system. main.cpp: #include <cstdlib> int main(int argc, char** argv) { std::system("cut -f1 anyExistingFile | sort > newSortedFile"); return 0; } I tired to perform profiling as following: $ g++ main.cpp -o myApp -std=c++11 $ env CPUPROFILE=out.prof LD_PRELOAD="/usr/local/lib/libprofiler

Using GPerf Tool: not working, issue with redirection?

纵饮孤独 提交于 2019-12-11 04:26:24
问题 I'm trying to profile my software in order to optimize it. I used gprof with the compilation flag -g -pg -O3 but the result are not giving me enough precision. Here is my Stacktrace of compilation: $: make clean; make; rm -f ./obj/*.o rm -f ./bin/mdk-verifier rm -f ./grammar/modal.output rm -f ./grammar/modal.tab.h rm -f ./grammar/*.cpp rm -f ./lex.backup bison -d -t -l -v -o ./grammar/modal.tab.c ./grammar/modal.y && mv ./grammar/modal.tab.c ./grammar/modal.tab.cpp g++ -O3 -g -pg -fPIC -std

Why do I see edges in the call graph that don't exist using gperftools?

限于喜欢 提交于 2019-12-10 10:36:20
问题 Given the following code that either calls f or g #include <stdlib.h> #include <stdio.h> int f() { return 0; } int g() { return 1; } int main() { long sum = 0; for(int i = 0; i < 1000*1000*1000; i++) { int result; if(rand() % 2 == 0) { result = f(); } else { result = g(); } sum += result; } printf("%ld\n", sum); } I compile with g++ test.c -o doom -lprofiler -lunwind And run with CPUPROFILE=./test.txt ./test And then generate a gif with pprof --gif ./test ./test.txt > output.gif I get the

How exactly does gperftools CPU profiler start?

五迷三道 提交于 2019-12-10 02:26:31
问题 gperftools documentation says that libprofiler should be linked into a target program: $ gcc myprogram.c -lprofiler (without changing a code of the program). And then program should be run with a specific environment variable: CPUPROFILE=/tmp/profiler_output ./a.out The question is: how does libprofile have a chance to start and finish a profiler when it is merely loaded, but its functions are not called? There is no constructor function in that library (proof). All occasions of "CPUPROFILE"