gprof

out of memory allocating

i try to use gprof command: gprof -s executable.exe gmon.out gmon.sum to merge profiling data gethered from 2 runs of my prog. but the following line appears: gprof: out of memory allocating 3403207348 bytes after a total of 196608 bytes my prog is quite simple(just one for loop), if i run once, the run time is too short( it shows ...

Benchmarking (gprof) C++ program. Using eclipse environment.

Well I've the following problem. Facts; - Using eclipse - Using MinGW I wanted to benchmark my created C++ program. I searched google and then came; http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html I then wanted to add the "-pg" build command. But how/where do I add it? I went in to the "properties - C/C++ build - Discovery Optio...

Profiling C code on Windows when using Eclipse

I know I can profile my code with gprof and kprof on Linux. Is there a comparable alternative to these applications on Windows? ...

Optimization: A tool like gprof for visual studio

As a C# programmer, i'm in a transition from small projects to medium projects. I didn't need a profiler for my little projects before. But now I need a tool that help me improving the performance of my code. I used gprof many years ago, in C. Can someone give me a starting point, or recommend me a tool like gprof for VS2008? That is: A...

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 using -pg option, it produces a .so file just fine. But, recompiling the Executable A ag...

Is it possible to get a graphical representation of gprof results?

Hi, I am interested in getting the profiling of some number crunching program. I compiled it with -g and -pg options and linked it and got it gmon.out. After reading the info (plain text) it looks a bit ugly. I wonder if there are some open source tools for getting a graphical representation of the 10 functions where the program spends ...

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

Hi, 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 this? Can you recommend any better alternatives? P.D. Which are the open source soluti...

How to profile multi-threaded C++ application on Linux?

I used to do all my Linux profiling with gprof. However, with my multi-threaded application, it's output appears to be inconsistent. Now, I dug this up: http://sam.zoy.org/writings/programming/gprof.html However, it's from a long time ago and in my gprof output, it appears my gprof is listing functions used by non-main threads. So, ...

Measuring execution time of selected loops

I want to measure the running times of selected loops in a C program so as to see what percentage of the total time for executing the program (on linux) is spent in these loops. I should be able to specify the loops for which the performance should be measured. I have tried out several tools (vtune, hpctoolkit, oprofile) in the last few ...

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 different results, and I would like to see where the bottlenecks in my application are in r...

Why does gprof tell me that a function that is called only once from main() is called 102 times?

Hello. I am a beginner, and wrote the following program for fun, to search through a directory and replace every occurrence of one word with another. I call the crt_ls_file() function once, and once only, but gprof tells me it is being called 102 times. I am wondering if anyone knows why this is. I have tried compiling the program will a...

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. I need to know which portions of the disk i/o take up the most time. ...

Why do debug symbols so adversely affect the performance of threaded applications on Linux?

Hi. I'm writing a ray tracer. Recently, I added threading to the program to exploit the additional cores on my i5 Quad Core. In a weird turn of events the debug version of the application is now running slower, but the optimized build is running faster than before I added threading. I'm passing the "-g -pg" flags to gcc for the debug...

How do I exclude stuff from gprof output?

I'm trying to profile an application I have, but I don't want anything related to the UI (made in wxWidgets) to show up in gprof's callgraph etc. How can I do this? ...

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 able to profile my code, using gprof if possible. What can I do? Is there a gprof opti...

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 (i = 0; i < 1000; i++) { r += b / (a + 1); } return r; } int main()...

C++ main only uses ~20% time says gprof

I tried profiling my C++ program with gprof. The program itself ran for about 53 seconds, so I dont understand why it says, main only ran for about 8.29 seconds. Any explanation on this? Here is an excerpt: index % time self children called name <spontaneous> [2] 20.5 0...

gprof on snow leopard problem

Problem lies in the fact that gmon.out file doesnt show correct data. All times are 0, and nothing is measured. gmon.out file is normally generated. I am using eclipse ide for c++, and linking, compiling and running programs as normal. Any help? ...

Use gprof on a .so library?

Hey, I'm building a .so plugin and would like to profile it using gprof. At the moment, I don't have the ability to rebuild (with the -pg option) the executable that links to it. Is it possible to use gprof to profile just this .so file once it's loaded up and linked to? ...

How to use gprof to profile a daemon process without terminating it gracefully?

Need to profile a daemon written in C++, gprof says it need to terminate the process to get the gmon.out. I'm wondering anyone has ideas to get the gmon.out with ctrl-c? I want to find out the hot spot for cpu cycle ...