Source-Changes archive

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

Re: CVS commit: src/lib/libc/gen



On Wed, Aug 20, 2003 at 02:21:49AM +1000, matthew green wrote:
>    
>    We don't even guarantee that the 'user time' and 'system time' reported
>    by getrusage be monotonic [1].  Never mind what happens to the child times
>    of a shell that runs date(1) to change the system time.
>    
>       David
>    
>    [1] even their sum can go down.
> 
> 
> why?  this just seems _wrong_ to me.  i can see getting them wrong but
> them going _backwards_ seem like a bug we can avoid...

It happens because netbsd actually sums the time that the process
is active, and then divides it up into system, user and interrupt
time based on the state when the process is interrupted by clock ticks
(whereas a 'traditional' system would only count the clock ticks).

This means we get usec accuracy on the total execution time of the
process but the apportioning could easily go from 'all user' to
'50-50 user-system' with a minimal increase in the total time.

Worse still, the times are based on system UTC time on each process
switch.  So if the system time is changed then the change in real time
is added to the execution time.
Bugs in microtime just make things even worse!

Fixing this really needs UTC time to be kept as 'time since boot' + 'boot time'
with all time warps affecting the 'boot time'.

        David

-- 
David Laight: david%l8s.co.uk@localhost



Home | Main Index | Thread Index | Old Index