tags:

views:

111

answers:

3

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, char*buf)
        { ... lots of code here ...;
        }
};
A: 

I believe that C++ template parameters and arg types are used inside the function's name. You could maybe use sed on the profiler output file.

This tool can parse them out of the output file also: http://linux.wareseeker.com/download/gprof2dot.py-0.3.rar/331443

Sean A.O. Harney
+1  A: 

Here is python script that can parse this: gprof2dot. The page has further references too.

Personally, I like the Google Performance Tools which can, among other things, also directly generate call graphs (via graphviz / dot).

Dirk Eddelbuettel
I'm after the format that I need to specify to gprof on command line for templated methods ... e.g. does it require full specification or just method name? ...
stefanB
A: 

I was after the actual format to be used on command line. I can see the compiled symbols by looking at the generated files but I'm not sure what format to use on command line. Thanks anyway for all answers.

stefanB