[linux-audio-user] profiling

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

 



On Wed, Dec 07, 2005 at 07:13:30 -0800, Noah Roberts wrote:
> Could the RT patch be interfearing with my ability to run gprof? 
> AFAICT I did everything right to use it, used the -pg on compile for
> instance, but my profiles have no time at all in them:

IIRC gprof works by sampling program activity at some interval. My
experience with realtime code is that it doesnt spend long enough doing
anything in particular to get meaningful results.

I think you will get better results by using cachegrind et al and running
in freewheel mode so it doesn't get kicked off. 

Failing that you can write your own profiling code reasonably easily, just
use gettimeofday before and after ciritcal sections, and sum the results
from each run. The (ugly and scrappy, but largely automatic) code I use is
here:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/threestore/threestore-v3/src/timing.c?rev=1.5
http://cvs.sourceforge.net/viewcvs.py/*checkout*/threestore/threestore-v3/src/timing.h?rev=1.4

Just uncomment the #define TIMING line to enable it, call TIME(NULL) to
initialise or reset, and TIME("label") at each checkpoint. At the end of
your run call TIME(TS_TIMING_REPORT) and it will print the total time
spent in each section, and some stats.

Don't rely on it for anything critically important though, the code is
pretty unsafe, and can have a heisenberg effect if cache utility is
important to your code and you call TIME too often.

- Steve

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux