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
9
votes
3 answers

`gprof` time spent in particular lines of code

I've been using the gprof profiler in conjunction with g++. I have a function in my code which encapsulates several sections of behaviour which are related enough to the primary function that it would not make sense to split them off into their own…
Richard
  • 56,349
  • 34
  • 180
  • 251
9
votes
2 answers

What does the -p and -g flag in compiler?

I have been profiling a C code and to do so I compiled with -p and -g flags. So I was wandering what do these flags actually do and what overhead do they add to the binary?
Syntax_Error
  • 5,964
  • 15
  • 53
  • 73
9
votes
1 answer

gprof producing no output for a program that takes reasonable time to execute

I know that similar questions have been asked before, but: In regards to gprof produces empty output I am using GCC 10.2.0 from MSYS2 on Windows 10, i.e. it's a MingW64 distribution. I have also added -no-pie to the linker arguments with no results…
NeomerArcana
  • 1,978
  • 3
  • 23
  • 50
9
votes
3 answers

gprof gives no output

I am trying to use gprof to profile some numerical code I am developing, but gprof seems to fail to collect data from my program. Here is my command line: g++ -Wall -O3 -g -pg -o fftw_test fftw_test.cpp -lfftw3 -lfftw3_threads -lm &&…
Elias
  • 234
  • 2
  • 9
9
votes
1 answer

Compiling in g++ for gprof

I do not understand the documentation for gprof regarding how to compile your program for profiling with gprof. In g++, is it required to compile with the -g option (debugging information) in a addition to the -pg option or not. In each case I get…
myahya
  • 3,079
  • 7
  • 38
  • 51
9
votes
2 answers

What is function __tcf_0? (Seen when using gprof and g++)

We use g++ 4.2.4 and I'm trying to track down some performance problems in my code. I'm running gprof to generate the profile, and I'm getting the following "strangeness" in that the most expensive function is __tcf_0: Each sample counts as 0.01…
Richard Corden
  • 21,389
  • 8
  • 58
  • 85
9
votes
3 answers

Problem with gprof on OS X: [program] is not of the host architecture

I'm having trouble running gprof on OS X. The file test.c is: #include int main() { printf("Hello, World!\n"); return 0; } and my terminal looks like: $ gcc -pg test.c $ gcc -pg -o test test.c $ ./test Hello, World! $ gprof…
Jesse Beder
  • 33,081
  • 21
  • 109
  • 146
8
votes
5 answers

Get gprof to profile based on wall-clock time?

My understanding is that by default gprof takes into account CPU time. Is there a way to get it to profile based on wall-clock time? My program does a lot of disk i/o, so the CPU time it uses only represents a fraction of the actual execution time.…
jetwolf
  • 81
  • 1
  • 2
7
votes
1 answer

View gprof output in kcachegrind

How to view output of gprof in kcachegrind? Is here a converter from gcc's gmon.out into callgrind.out?
osgx
  • 90,338
  • 53
  • 357
  • 513
7
votes
6 answers

What are _Unwind_SjLj_Unregister and _Unwind_SjLj_Register?

What are _Unwind_SjLj_Unregister and _Unwind_SjLj_Register? I get them as my top processor time users in my gprof report. google only returns links to people complaining about errors with these two. heres the only part of my report that has times…
calccrypto
  • 8,583
  • 21
  • 68
  • 99
7
votes
1 answer

What does -Wall flag do when I compile it with the program?

I am following a tutorial that says how to profile the program using gprof and the command given is like this gcc -Wall -pg test_gprof.c test_gprof_new.c -o test_gprof But it doesn'y give any explanation for this flag (-Wall)
7
votes
1 answer

How to build-in gprof support to a program built with SCons?

Greetings, Here is my SConstruct file: env = Environment() env.Append(CCFLAGS=['-g','-pg']) env.Program(target='program1', source= ['program1.c']) Also here is the output of the compilation: scons: Reading SConscript files ... scons: done reading…
kobrien
  • 2,931
  • 2
  • 24
  • 33
7
votes
1 answer

How to analyze program running time

I am trying to optimize a c++ program's performance and reduce its run time. However, I am having trouble figuring out where is the bottleneck. time command shows that the program itself takes about 5 minutes to run, and about the 5 minutes, user…
yangsuli
  • 1,252
  • 5
  • 16
  • 33
6
votes
2 answers

gprof - File is missing call-graph data

I'm just starting out with gprof and am trying to generate a call graph. I'm using cmake for setting up my makefiles and I'm setting CMAKE_EXE_LINKER_FLAGS = -gp to enable profiling. The only cxx flags I have enabled is -g. Then I simply call gprof…
Vaidy
  • 61
  • 1
  • 2
6
votes
2 answers

gprof command is not creating proper out.txt

First of all I'm running MacOSX 10.7.1. I've installed all properly, Xcode 4 and all the libraries, to work with C lenguage. I'm having troubles running gprof command in shell. I'll explain step by step what I'm doing and the output I'm…
Roger Fernandez Guri
  • 970
  • 2
  • 10
  • 18
1 2
3
21 22