gprof

gprof: Any way to specify the location of profile data

The default the profile file is from the executable is run and the file is called gmon.out. Is there any way to specify a new location? I'm using gcc 3.4.6 on i386/linux2.6 ...

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 0.32 0.32 5498021 0.00 0.00 [whatever] Why does it list 31.07% of time if ...

Speeding up virtual function calls in gcc

Profiling my C++ code with gprof, I discovered that a significant portion of my time is spent calling one virtual method over and over. The method itself is short and could probably be inlined if it wasn't virtual. What are some ways I could speed this up short of rewriting it all to not be virtual? ...

gprof and arguments to executable

when using gprof: gprof options [executable-file [profile-data-files...]] [> outfile] if you have options to pass to the executable like: gprof a.out --varfred=32 then gprof assumes that i am passing an invalid option to gprof instead of the a.out. Any way to get around this? ...

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 functions get called by processing gprof's output. Only functions that are called at least once ap...

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 name ---------------------------------------- 1.77 0 1/1 main [2] [...

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? ...

Compilers compatible with gprof?

I am looking for a list of compilers able to generate a gprof output. ...

gprof reports no time accumulated

I'm trying to profile a C++ application with gprof on a machine running OSX 10.5.7. I compile with g++ in the usual way, but using -pg flags, run the application and try to view the call graph with gprof. Unfortunately my call graph contains all zeroes for all time columns. The values in the "called" columns have reasonable values so it...

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 <stdio.h> 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 test gprof: file: test is not of the host architecture Edit: also, it doesn't generate the fil...

Format of parameter to display call graph for templated method with gprof?

What is the command line format to display function call graph for a method in templated class with gprof? For simple C method you would specify it like: gprof -f foo myprogram > gprof.output How do you specify method parse from the following: template <typename T> class A { public: template <typename X> bool parse(X& x,...

Profile single function in gprof

Is it possible to use gprof to line-profile a single function in C++? gprof -l -F function_name ... does not seem to work. Thanks, Bi. ...

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 seconds. % cumulative self self total time seconds sec...

unable to accumulate time using gprof - the gnu profiler

I am running cygwin on windows and using latest version of gprof for profiling my code. My problem is that the flat profile shows zero sec for each of the functions in my code, I even tried to loop the functions(tried a for loop for a million) but gprof is unable to accumulate any time .Please help . Here is one of my sample function. b...

Swap 2D Double Arrays in c++

I have the following method to swap two double arrays (double**) in c++. Profiling the code, the method is accounting for 7% of the runtime... I was thinking that this should be a low cost operation, any suggestions? I am new with c++, but i was hoping to just swap the references to the arrays. 62 void Solver::Swap(double** &v1, dou...

gprof error: profile file has unsupported version

I am trying to profile a shared library but there is an error when I invoke gprof: $ export LD_PROFILE=libMy.so $ ./a.out $ gprof -q libMy.so /var/tmp/libMy.so.profile gprof: file /var/tmp/libMy.so.profile has unsupported version 131071 Shared library was compiled with -ggdb -pg flags. gcc version 4.2.1, gprof versio...

How to modify a C program so that gprof can profile it?

When I run gprof on my C program it says no time accumulated for my program and shows 0 time for all function calls. However it does count the function calls. How do I modify my program so that gprof will be able to count how much time something takes to run? ...

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 --enable-prof). The problem is that the tests are in a different directory then the executab...

Does gprof take time spent blocked into account?

I am running gprof on my executable, but the executable spends a lot of time wait()ing for child processes to complete. Is the time spent waiting factored in to the gprof timings? ...

How to profile a shared object without profiling the host app?

I have a host application and I have written a plug-in. I compile my plug-in down to a shared object (say foo.so), and the host application will load it via dlopen. In this case, my host application is the opt tool from llvm (though I don't think that's important to the question). I'd like to compile my plug-in with profiling enabled ...