autoconf
[Top][All Lists]
Advanced

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

Re: M4 profiling for autoconf


From: Paul Eggert
Subject: Re: M4 profiling for autoconf
Date: Sun, 5 Aug 2001 23:42:46 -0700 (PDT)

> From: address@hidden
> Date: Sun, 5 Aug 2001 21:06:38 +0200
> 
> I would like to implement profiling in M4, but my knowledge is poor
> (I don't even know how to get some precise time from the system,

The standard portable ways to do that are clock_gettime (which has
nanosecond resolution) and gettimeofday (which has only microsecond
resolution, but is a tad more portable in practice, and on Solaris
anyway is implemented via a dedicated kernel entry so it's a bit
faster).

If you're willing to be unportable you can do better, e.g. the
gethrtime() and gethrvtime() functions of Solaris 8 give you
nanoseconds of real and execution time.

If you really want to go off the deep end,
I suppose you could also do hardware profiling a la Perfmon (for Solaris)
<http://www.cps.msu.edu/~enbody/perfmon.html>
or Rabbit or perfctr (for Linux)
<http://www.scl.ameslab.gov/Projects/Rabbit/>
<http://www.csd.uu.se/~mikpe/linux/perfctr/>

> counting by second is certainly not fine enough, and worse yet, I
> don't even have the slighest idea of how to get durations that are
> not penalized by the profiling itself.

I wouldn't worry about it for this application; the profiling cost
is relatively small, and can be approximately-subtracted anyway.

For ideas about how to implement profiling in M4, I suggest looking to
see how the Python folks did it, as I suspect that the problems are
similar.  For starters, please see:

http://www.python.org/doc/current/lib/profile.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]