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
5
votes
2 answers

Using gprof with sockets

I have a program I want to profile with gprof. The problem (seemingly) is that it uses sockets. So I get things like this: ::select(): Interrupted system call I hit this problem a while back, gave up, and moved on. But I would really like to be…
Chris Tonkinson
  • 13,823
  • 14
  • 58
  • 90
5
votes
2 answers

gprof a library - question

I need to gprof a library in our system to examine the function calls and see if we can optimize it any more. Basically, what I have is Executable A which uses a shared Library myLib.so I want to gprof the myLib.so. When I compile myLib.so source…
ramsci
  • 51
  • 1
  • 2
5
votes
1 answer

gprof not showing call graph

I am running my program with the -pg option. When I open the output gmon.out it only cumulative list and not call graphs. How do I fix that? I know this was asked before here: gprof - File is missing call-graph data But no one actually answered…
postelrich
  • 3,274
  • 5
  • 38
  • 65
5
votes
3 answers

What is _IO_wfile on a gprof output of a fortran code?

I have some fortran code compiled with intel fortran compiler ifort. When I do a profile test with gprof, I get that most of the time is used in IO operations, I think finding the end of the files, but I can no find any more documentation on…
Gabriel
  • 113
  • 5
4
votes
2 answers

Using gprof with pthreads

Can gprof be used to profile a multi-threaded program that uses pthreads? That is, will its output include the time used in all the threads?
Nathan Kitchen
  • 4,799
  • 1
  • 24
  • 19
4
votes
2 answers

Finding which functions are called in a multi-process program without modifying source?

I'm working on a project where I need to find which functions get called in various Linux programs (written in C) given particular inputs. My current approach has been to compile a program with -pg (profiling option), run it, and find which…
Jay Conrod
  • 28,943
  • 19
  • 98
  • 110
4
votes
0 answers

WSL gprof reporting zero times

I'm trying to use gprof in WSL on Windows 10. I hadn't anticipated any difficulty, because it worked fine last time I used it in an Ubuntu virtual box on Windows 7. Following as before the directives from…
rwallace
  • 31,405
  • 40
  • 123
  • 242
4
votes
1 answer

Gprof shows regular functions in the app as called from

So - I've been writing a language interpreter as a side project for a year now. Today I have finally decided to test its performance for the first time! Maybe I should have done that sooner... turns out running a Fibonacci function in the language…
Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131
4
votes
0 answers

Exclude C++ standard library function calls from gprof output

I am using the C++ standard library in some C++ code and this makefile: CC=g++ CXXFLAGS=-Wall -Werror -ggdb3 -std=c++11 -pedantic $(OTHERFLAGS) cpp_sort: cpp_sort.o g++ -o $@ $(CXXFLAGS) $^ clean: rm -rf *.o cpp_sort *~ The source…
Angus Comber
  • 9,316
  • 14
  • 59
  • 107
4
votes
6 answers

Confusing gprof output

I ran gprof on a C++ program that took 16.637s, according to time(), and I got this for the first line of output: % cumulative self self total time seconds seconds calls s/call s/call name 31.07 …
Jesse Beder
  • 33,081
  • 21
  • 109
  • 146
4
votes
1 answer

gprof output is empty

Using gprof 2.28 and gcc 6.3.0 in Ubuntu 17.04 on a variety of sample programs I get empty output for every category. If I run gprof -i on one example program I get: 1 histogram record 2 call-graph records 0 basic-block count records My compilation…
Paul
  • 663
  • 7
  • 11
4
votes
1 answer

Time Sampling Problems with gprof

I am attempting to profile some c++ code, compiled with g++ including the option -pg, using gprof. However, in spite of the fact that the program takes 10-15 minutes to run on my computer (with the CPU maxed out), the % time, cumulative seconds and…
Mark Bell
  • 880
  • 1
  • 12
  • 22
4
votes
2 answers

Convert simple ascii table to CSV

I have gprof output shown below and I want to convert it to CSV format. What's the easiest way to do this from the cmd line? (I have many of these types of files, I need to automate this.) % cumulative self self total time …
Daryl
  • 3,253
  • 4
  • 29
  • 39
4
votes
1 answer

Capturing function exit time with __gnu_mcount_nc

I'm trying to do some performance profiling on a poorly supported prototype embedded platform. I note that GCC's -pg flag causes thunks to __gnu_mcount_nc to be inserted on entry to every function. No implementation of __gnu_mcount_nc is available…
moonshadow
  • 86,889
  • 7
  • 82
  • 122
4
votes
3 answers

gprof with Qt application

I need help with profiling my C++ Qt application on target, both memory usage and cpu load. I was recomended gprof, but can't seem to get it to work. These are the guides I tried to follow:…
A.Faur
  • 93
  • 2
  • 8