[Shootout-list] fannkuch

Brent Fulgham bfulg@pacbell.net
Mon, 23 May 2005 12:31:19 -0700 (PDT)


--- Bengt Kleberg <bengt.kleberg@ericsson.com> wrote:
> On 2005-05-20 19:23, Brent Fulgham wrote:
> ...deleted
> > But you are right -- our runtimes are probably
> > low enough that we are encountering measurement
> > noise.
> 
> that could be quantified if we find out the
> granularity of the timer. 

Here some info that might belong in the FAQ:

1.  The timer measurements are made using the 
BSD::Resource Perl module.  The 'times' method makes 
two internal calls to 'getrusage' to get this data.

>From the POD
(http://search.cpan.org/~jhi/BSD-Resource-1.24/Resource.pm):

"The current implementation uses two getrusage()
system calls: one with RUSAGE_SELF (the current 
process) and one with RUSAGE_CHILDREN (all the child 
processes of the current process that have terminated
at the time the call is made). Therefore the 
operation is not 'atomic': the times for the children
are recorded a little bit later."

So, this is one potential source of measurement error,
though probably negligible.

2.  There was a bug in the 2.6.8 and below Linux
Kernels where some thread time was not accounted if
the thread did not 'join' with its parent process
prior to terminating.  This was fixed in the 2.6.9 
release, so is not an issue for us.

3.  The 'struct timeval' used to hold the user and
system time has a microsecond resolution.

IIRC, testing that we did in C using the underlying
'getrusage' methods indicate that the resolution
of the timings was about 0.01 second.

That's the sum total of available information on the
resolution of the timings provided by the shootout.

-Brent