Questions tagged [gprof]

gprof is a GNU tool used for code profiling.

To use it you need to compile your code with gcc and the option -pg. Then execute your software; it will create a file named "gmon.out". gprof can analyze this file and provide you with performance information about the execution of your software.

322 questions
3
votes
0 answers

Function never called but shown by gprof for C code?

I am having the upper issue and was wondering if this is a bug or I am using gprof wrong? So as usual I compile my C code with -pg commands, and then after running it I do gprof ./my_program gmon.out >> gmon.txt. Then in the output I noticed one…
malajedala
  • 867
  • 2
  • 8
  • 22
3
votes
0 answers

Does gcc -pg option affect core size?

I am working with gcc -pg option in order to do some profiling on my C++ program usign gprof. I have added -pg option to both linking and compiling, and added a call to exit(0) in order to have a clean exit point, and I am able to obtain a gmon.out…
3
votes
1 answer

linux: is there any job that "gprof" can do while "perf" cannot? Need clarification

Both tools are linux performance and profiling probing tool. I found that "perf" looks more powerful as it could trace into kernel call level. So my question is, with "perf", is there still a need to learn and keep "gprof"/ I mean, is there any work…
Troskyvs
  • 7,537
  • 7
  • 47
  • 115
3
votes
2 answers

Missing function from GProf output

I'm trying to profile some C code but one of the most intuitively costly functions isn't showing up in the GProf output. int main() { initialise... haloSwap(); for(...) { functions... propagate(); functions... …
Kallum Burgin
  • 93
  • 2
  • 15
3
votes
0 answers

How to exclude namespace from gprof?

I am using gprof to profile my application. I use gprof2dot to produce graphs, but the graphs tend to be large because there is plenty of "chain" calls of boost:: functions. Is there a way to remove this not necessary boost:: functions from the…
Grzegorz
  • 81
  • 7
3
votes
1 answer

GPROF flat profile empty result

I'm trying to use gprof (I have to use gprof - no other option is available) when I get the flat file the result is empty even though everything works fine. By the way, the code is in c so I'm using gcc. Result: Each sample counts as 0.01…
RedHood148
  • 429
  • 2
  • 4
  • 14
3
votes
3 answers

Strange profiler behavior: same functions, different performances

I was learning to use gprof and then i got weird results for this code: int one(int a, int b) { int i, r = 0; for (i = 0; i < 1000; i++) { r += b / (a + 1); } return r; } int two(int a, int b) { int i, r = 0; for…
arthurprs
  • 4,457
  • 3
  • 26
  • 28
3
votes
0 answers

GNU Profiler Empty Flat Profile

I am trying to learn profiling with GNU gprof, and I just tried to take the same results as in this tutorial by using exactly the same code and applying the same steps there: http://www.ibm.com/developerworks/library/l-gnuprof.html However, when I…
oicrisah
  • 83
  • 6
3
votes
2 answers

Profile non-terminating C program using gprof

I am trying to profile a program using gprof. The point is that for some cases the program does not finish by itself but by using the Linux execution time limit. In this case the file 'gmon.out' is not generated. I was wondering if there exists a…
pafede2
  • 1,626
  • 4
  • 23
  • 40
3
votes
6 answers

How to get the call graph of a program with a bit of profiling information

I want to understand how a C++ program that was given to me works, and where it spends the most time. For that I tried to use first gprof and then gprof2dot to get the pictures, but the results are sometimes kind of ugly. How do you usually do…
Open the way
  • 26,225
  • 51
  • 142
  • 196
3
votes
1 answer

Does gprof support multithreaded applications?

We're developing a multithreaded project. My colleague said that gprof works perfectly with no work around with multithreaded programs. I read otherwise some time…
AturSams
  • 7,568
  • 18
  • 64
  • 98
3
votes
1 answer

Gprof: specific function time

I want to find out the time spent by a particular function in my program. FOr that purpose, I am making use of gprof. I used the following command to get the time for the specific function but still the log file displays the results for all the…
Xara
  • 8,748
  • 16
  • 52
  • 82
3
votes
1 answer

Cannot get makefile to produce gmon.out

I am trying to profile my code since I can't figure out what is slowing it down. I have the following makefile: CXX=gcc RM=rm -f CFLAGS=-pg -DNDEBUG -O3 -g3 -O0 -D_FILE_OFFSET_BITS=64 LDFLAGS=-pg -lpthread `pkg-config fuse --cflags --libs` EXEC =…
MasterGberry
  • 2,800
  • 6
  • 37
  • 56
3
votes
0 answers

Opencv Profilg with Gprof

I am using opencv in my application and trying to profile my code..To know which function is taking much time.But when I use Gprof to profile my code it is not giving me the time taken by Opencv functions which are internally called by user…
3
votes
1 answer

Profiling library equivalent to gprof/callgrind

I'm looking for a C/C++ library with profiling capabilities such as gprof, or callgrind. More precisely, I want its output to be equivalent to what callgrind would issue, in order to pass it to third-party tools such as KCacheGrind. The idea is to…
jopasserat
  • 5,721
  • 4
  • 31
  • 50