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
0
votes
1 answer

gprof gives Dwarf Error

I have compiled my apache2 on different server with gcc options, -pg -DGPROF -g -DNO_USE_SIGACTION I copied this apache2 binary to different server and executed it once and got gmon.out. But when creating the analysis file using command, gprof…
VoidPointer
  • 3,037
  • 21
  • 25
0
votes
0 answers

qsort performance on mac os x

I have a program that generates 10000 integers from a set of 1000000 (may contain duplicates). The file generator function is below : void generateNumberFile() { const char* filename = "/tmp/integerfile.csv"; FILE *numberFile =…
dlsa
  • 3,402
  • 2
  • 17
  • 17
0
votes
1 answer

Why calls of main is more than once in gprofile profile?

Here is what I got from the profile data. I can't understand why calls of main is more than once? % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 …
notbad
  • 2,797
  • 3
  • 23
  • 34
0
votes
1 answer

gprof shows every function as 100%

I'm using a modified auditd package, and linked gprof with it. But from the output of gprof XX | gprof2dot | dot -Tpng output.png, all functions are 100% usage, so I cannot tell who's consuming most of the CPU resources. (Right click on the image to…
daisy
  • 22,498
  • 29
  • 129
  • 265
0
votes
1 answer

C: reducing runtime for optimization

I have below output from gprof for my program: Flat profile: Each sample counts as 0.01 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name …
Diwakar Sharma
  • 415
  • 1
  • 9
  • 26
0
votes
1 answer

lost hot functions from gprof output

I have gprof working fine on a linux system. I am getting samples and also some call count information. So I added the attribute ((hot)) to some functions. Now they have disapeared from the gprof sample output, only my none hot functions are…
0
votes
1 answer

Maximum stack size usage

I have a function written in C which looks like this void function1(){ if(!some_condition){ function1(); } } This is compiled in gcc on a RedHat linux based machine. Is there a profiling tool that can tell me the maximum amount…
hrs
  • 487
  • 5
  • 18
0
votes
1 answer

gprof - Executable in a remote location (in PATH)

I have a series of blackbox tests made from shell scripts (Similar to that of the tests for GNU Hello). I am trying to get it to generate the flat-profile automatically if the gmon.out is found (and it will be if the project was configured with…
alternative
  • 12,703
  • 5
  • 41
  • 41
0
votes
1 answer

gprof output not being generated when executed in bash script

I've compiled and linked my application with -pg, and when running the application I get the correct gmon.out file and can analysis it with gprof. I am running a number of scripts under different situations to discover a speed issue between two…
nlucaroni
  • 47,556
  • 6
  • 64
  • 86
0
votes
1 answer

Some doubts about the graph generated by gprof and gprof2dot

I used gprof2dot to generate the graph below, which visualized my program's profiling output. I have some doubts about the graph: First, why the root of the call tree isn't main(), and the root Bat_Read() even not appeared in my program, but is…
foool
  • 1,462
  • 1
  • 15
  • 29
0
votes
0 answers

Multiple definition compile errors using -pg flag for gprof in C++

I am trying to compile some C++ code to be used with gprof, and have tried using the -pg flag, but am getting errors regarding multiple definitions for each of my functions. My command is basically g++ -o -pg my_exec my_code.cp -mylib. Any idea…
yodafan86
  • 565
  • 1
  • 6
  • 14
0
votes
1 answer

How to understand the gprof outputs?

Here is my source code #include #include #include #include #include #include #include static void set(const char *buf) { static std::string *localstring; …
Pan Ruochen
  • 1,990
  • 6
  • 23
  • 34
0
votes
3 answers

Why is function call taking significantly longer than code executed according to gprof?

I'm learning how to profile my code with gprof. For one of my applications, I have the following output: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call …
gsgx
  • 12,020
  • 25
  • 98
  • 149
0
votes
1 answer

Could Gprof be more detailed?

I'm trying to profile my C code with gprof. I'm compiling .a library with -pg option and compiling executable also with -pg and with this .a library. Running. Getting gmon.out. Viewing it using Eclipse. And all I getting is something like showed at…
hasnobrains
  • 109
  • 6
0
votes
1 answer

Would the time counted in gprof include what is spent in functions that are not profiled?

I now have a project which I want do profiling on, but it used another library which I have no control of. Say if there if such a function: #include void function(...) { // do something for (...) { // ... …
fefe
  • 3,342
  • 2
  • 23
  • 45
1 2 3
21
22