gprof

Has anybody used gprof, does gcc support full range of gprof’s compile
options?
It seems line profiling does not work.

Jiri Kristek
RETIA, a.s.

Jiri Kristek <jkristek@retia.cz> wrote:

Has anybody used gprof, does gcc support full range of gprof’s compile
options?
It seems line profiling does not work.

Hmmmmm, it looks like DWARF-1 is pretty lacking in that area. Try
compiling with STABS or DWARF-2 debugging information (-gstabs or -gdwarf-2)


cburgess@qnx.com

Both work, thanks.

Colin Burgess <cburgess@qnx.com> pí¹e v diskusním
pøíspìvku:96bpl1$cub$1@nntp.qnx.com

Jiri Kristek <> jkristek@retia.cz> > wrote:
Has anybody used gprof, does gcc support full range of gprof’s compile
options?
It seems line profiling does not work.

Hmmmmm, it looks like DWARF-1 is pretty lacking in that area. Try
compiling with STABS or DWARF-2 debugging information (-gstabs
or -gdwarf-2)


cburgess@qnx.com

Colin Burgess a écrit :

Jiri Kristek <> jkristek@retia.cz> > wrote:
Has anybody used gprof, does gcc support full range of gprof’s compile
options?
It seems line profiling does not work.

Hmmmmm, it looks like DWARF-1 is pretty lacking in that area. Try
compiling with STABS or DWARF-2 debugging information (-gstabs or -gdwarf-2)


cburgess@qnx.com

It seems that it’s impossible to profile multi-threads programs. Right?

Alain.

It seems that it’s impossible to profile multi-threads programs. Right?

Looking at the code, it doesn’t appear to be thread-safe.


cburgess@qnx.com

Colin Burgess a écrit :

It seems that it’s impossible to profile multi-threads programs. Right?

Looking at the code, it doesn’t appear to be thread-safe.


cburgess@qnx.com

Maybe but it’s not what I wanted to know :slight_smile:, I tried to profile a
multithreaded resource manager but I didn’t saw my io functions!

Thanks,
Alain.

Hmm, I compile with -gdwarf-2, but my program does not
produce any gmon.out. Should I link with something?

Tom

Jiri Kristek wrote:

Both work, thanks.

Colin Burgess <> cburgess@qnx.com> > pí¹e v diskusním
pøíspìvku:96bpl1$cub$> 1@nntp.qnx.com> …
Jiri Kristek <> jkristek@retia.cz> > wrote:
Has anybody used gprof, does gcc support full range of gprof’s compile
options?
It seems line profiling does not work.

Hmmmmm, it looks like DWARF-1 is pretty lacking in that area. Try
compiling with STABS or DWARF-2 debugging information (-gstabs
or -gdwarf-2)


cburgess@qnx.com

When using gcc instead of qcc gmon.out was produced ok.

Tom

Tomas Högström wrote:

Hmm, I compile with -gdwarf-2, but my program does not
produce any gmon.out. Should I link with something?

Tom

Jiri Kristek wrote:

Tomas Högström a écrit :

When using gcc instead of qcc gmon.out was produced ok.

Tom

Tomas Högström wrote:

Hmm, I compile with -gdwarf-2, but my program does not
produce any gmon.out. Should I link with something?

Tom

Jiri Kristek wrote:

!?! I don’t know if gcc adds the proper option automatically but dwarf-2
is not supposed to enable profiling informations.
Normally, you have to add -p (for prof) or -pg (for gprof).
Qcc doc only talk about -p. I suppose it’s ok for gprof.

Regards,
Alain

Correct, I forgot to write that I used the -pg flag also.

It profiles ok now, but I get no time measurements and the message
“no time was accumulated”. Perhaps it means that all the the time
was spent in my libraries whis was not compiled for profiling. I do spend
a lot of time in these libraries, but it would IMHO be nice if the profiling
tools could report the total time spend in the routines calling the libraries.
But then, if statistical sampling is used I guess all the hits will be in the
CPU intensive libraries…
I ended up writing my own profiling tools instead.

Cheers / Tom

Alain Bonnefoy wrote:

Tomas Högström a écrit :

When using gcc instead of qcc gmon.out was produced ok.

Tom

Tomas Högström wrote:

Hmm, I compile with -gdwarf-2, but my program does not
produce any gmon.out. Should I link with something?

Tom

Jiri Kristek wrote:

!?! I don’t know if gcc adds the proper option automatically but dwarf-2
is not supposed to enable profiling informations.
Normally, you have to add -p (for prof) or -pg (for gprof).
Qcc doc only talk about -p. I suppose it’s ok for gprof.

Regards,
Alain

You can’t get timer information unless you run the profiled program as root.
Some of the timer calls that are used are priviledged instructions.

cheers,

Kris

Tomas Hogstrom <tomas@scandicraft.se> wrote:

Correct, I forgot to write that I used the -pg flag also.

It profiles ok now, but I get no time measurements and the message
“no time was accumulated”. Perhaps it means that all the the time
was spent in my libraries whis was not compiled for profiling. I do spend
a lot of time in these libraries, but it would IMHO be nice if the profiling
tools could report the total time spend in the routines calling the libraries.
But then, if statistical sampling is used I guess all the hits will be in the
CPU intensive libraries…
I ended up writing my own profiling tools instead.

Cheers / Tom

Alain Bonnefoy wrote:

Tomas Hogstrom a ecrit :

When using gcc instead of qcc gmon.out was produced ok.

Tom

Tomas Hogstrom wrote:

Hmm, I compile with -gdwarf-2, but my program does not
produce any gmon.out. Should I link with something?

Tom

Jiri Kristek wrote:

!?! I don’t know if gcc adds the proper option automatically but dwarf-2
is not supposed to enable profiling informations.
Normally, you have to add -p (for prof) or -pg (for gprof).
Qcc doc only talk about -p. I suppose it’s ok for gprof.

Regards,
Alain


Kris Warkentin
kewarken@qnx.com
(613)591-0836 x9368
“Computer science is no more about computers than astronomy is about telescopes”
–E.W.Dijkstra