> On Sep 11, 2017, at 9:25 AM, Theo de Raadt <[email protected]> wrote:
> 
>> Scott Cheloha:
>> 
>>> Use a monotonic clock for the elapsed time trial.
>> 
>> FreeBSD uses getrusage() to fetch the user time used.  I think that 
>> makes more sense.
>> 
>> https://svnweb.freebsd.org/base/head/sbin/md5/md5.c?revision=307658&view=markup#l293
> 
> The granularity is weak.  However you can stop such a process, then
> let it continue, and get a reasonable assessment of the cputime it
> actually used.  Which is perhaps closer to the stated goal.
> 
> Compared to that, CLOCK_MONOTONIC vs CLOCK_REALTIME vs whatever else
> doesn't seem that valuable a change to me.  I'll note none of these
> diffs come with a clear problem statement.

My thinking with the use of CLOCK_MONOTONIC was that it made the measured
time immune to clock jumps and changes to the system time by root via
settimeofday(2).

This gets us closer to what the time trial is trying to measure, even
if root does something like resetting the system clock in the midst of
the program's execution, which would make the output totally incorrect
if we were using gettimeofday(2).

--
Scott Cheloha

Reply via email to