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

How to profiling sections of code?

I need to profile a piece of software written in C. Now the problem is that while gprof or my own begin timer/end timer function calls would provide me time spent in each function, I would have no information about which is the most time consuming…
Rohit Banga
  • 18,458
  • 31
  • 113
  • 191
2
votes
0 answers

g++ gprof global constructors keyed to static member

I'm profiling a c++ app on linux compiled with g++. In the gprof output I'm getting some nontrivial usage statistics for: global constructors keyed to _ZN4CGps14ms_OutputNamesE Where _ZN4CGps14ms_OutputNamesE is the mangled name of a static member…
Simon Elliott
  • 2,087
  • 4
  • 30
  • 39
2
votes
1 answer

How to force a program compiled with '-pg' dump its stat info when it is still running?

I'm developing in C++(g++) with a non-opensource lib. every time I run the program, the lib will crash (it double-free some memory). it's ok for my program now. but it's bad for profiling. I use -pg to profiling the program. As a result of the…
wuxb
  • 2,572
  • 1
  • 21
  • 30
2
votes
3 answers

Why don't cycle summaries have any callers in gprof's call-graph output?

I use GNU gprof 2.15.94.0.2.2 to do profiling of my C++ program, which has large call cycles. I expected to see something like below in the call graph output as gprof's documentation indicates: index % time self children called …
an0
  • 17,191
  • 12
  • 86
  • 136
2
votes
1 answer

How to interprete gprof output

I just profiled my program with gprof and got this: 100.01 0.01 0.01 23118 0.43 0.43 std::vector >::operator=(std::vector > const&) Which confuses me, as it says that it is…
Sim
  • 4,199
  • 4
  • 39
  • 77
2
votes
0 answers

GCC call graph profiling (-pg, gprof) on iOS possible?

Is there a way to use GCC call graph profiling on iOS? Setting GENERATE_PROFILING_CODE in Xcode4 seems to have no effect when building for iOS devices (I also don't see -pg being passed to compiler or linker) and even if it had an effect, how would…
Mecki
  • 125,244
  • 33
  • 244
  • 253
2
votes
1 answer

gprof issue with output

The question is: Why is my gprof output only displaying "Index by function name" ? I have compiled my application with the support of this tutorial…
Oliver
  • 41
  • 3
2
votes
1 answer

how to use gprof in Linux?

I have a C code in a file test.c .I have to profile it using grof.I have used the following commands to do so. gcc -p -o result test.c ./result gprof result A section of the output looks as follows: `Flat profile: Each sample counts as 0.01…
station
  • 6,715
  • 14
  • 55
  • 89
2
votes
5 answers

vector access

I profiled my code using gprof and from the report, most, if not all of the top 20 or so things are about vector Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds …
calccrypto
  • 8,583
  • 21
  • 68
  • 99
2
votes
2 answers

Shorten function names in profling results with gprof2dot.py

I work usually with gprof + gprof2dot.py to profile C++ codes. A new code I am working with uses very long function names, so that the graphical results with gprof2dot.py are a mess. I wonder how can one shorten the function names so that they fit…
Open the way
  • 26,225
  • 51
  • 142
  • 196
2
votes
2 answers

Inaccuracy in gprof output

I am trying to profile a c++ function using gprof, I am intrested in the %time taken. I did more than one run and for some reason I got a large difference in the results. I don't know what is causing this, I am assuming the sampling rate or I read…
Syntax_Error
  • 5,964
  • 15
  • 53
  • 73
2
votes
3 answers

Do (sampling) profilers still "lie" these days?

Most of my limited experience with profiling native code is on a GPU rather than on a CPU, but I see some CPU profiling in my future... Now, I've just read this blog post: How profilers lie: The case of gprof and KCacheGrind about how what profilers…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
1 answer

gprof : function 'etext' is taking 100.05% of time running

I used gprof to get a profile of a c code which is running too slowly. Here is what I get: Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls Ts/call …
pulsar_hh
  • 125
  • 2
  • 9
2
votes
3 answers

gprof: unexpected EOF after reading 48/271618093 bins?

Does anyone know what this error means for gprof? I'm running gcc -pg. Thanks.
Dervin Thunk
  • 19,515
  • 28
  • 127
  • 217
2
votes
0 answers

Gprof with CMake

I'm trying to compile a project using gcc and gprof. Thus I added to CMakeLists.txt in CLion the following lines: SET(GCC_COVERAGE_COMPILE_FLAGS "-pg") add_definitions(${GCC_COVERAGE_COMPILE_FLAGS}) However when I run the compiled binary I doesn't…
user1315621
  • 3,044
  • 9
  • 42
  • 86