Re: profiling question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Juan Carlos Franzoy wrote:

> I compiled it with -pg and -g and installed it. After
> 24 hours it took more than 25% and we killed -15 it.
> It generates a gmon.out.
> 
> Out surprise was when we run gprof myapp gmon.out. All
> counters except where in zero. What am I doing wrong?

First note that gprof is part of binutils and not part of gcc so it'd
probably be better to use the binutils mailing list (binutils at
sourceware.org) for this.

The problem with terminating the program with kill -15 is that the
profiling library registers its mcleanup() routine with atexit(), and
this is what writes all the data to the gmon.out file.  So the app must
either return from main() or call exit() in order to get any profile
data, it won't happen for a SIGTERM or any other abnormal termination
sequence.  You might be able to work around this by e.g. installing a
signal handler that explicitly calls exit() or something.  Or perhaps
you could use a different profiling method like oprofile.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux