Timekeeping [Was: Re: cvs commit: src/usr.bin/vmstat vmstat.c src/usr.bin/w w.c]

Marcel Moolenaar marcel at xcllnt.net
Fri Oct 21 12:04:25 PDT 2005

On Oct 21, 2005, at 10:12 AM, Andre Oppermann wrote:

> Marcel Moolenaar wrote:
>> On Oct 21, 2005, at 9:05 AM, Poul-Henning Kamp wrote:
>>> In message <20051022011020.T5554 at delplex.bde.org>, Bruce Evans  
>>> writes:
>>>> How do you resync laptops after suspending them for long enough for
>>>> the clock to drift?  Use ntpd and let it step, or use ntpd -x  
>>>> and let
>>>> it take hours to resync?  The right thing to do is step the  
>>>> clocks to
>>>> the current time immediately so that they are correct while the
>>>> system
>>>> is actually being used.
>>> Ahh, and now we get into interesting territory:  What _is_ the
>>> definition of uptime for a laptop which has been suspended ?
>> I don't think the definition has to change, but I don't know what
>> the *exact* definition of uptime is. Wikipedia says this:
>> "Uptime is a measure of the time a computer system has been up and
>>   running. It came into use to describe the opposite of downtime,
>>   times when a system was non-operational."
>> Given this, suspend is downtime and the uptime is therefore defined
>> as the amount of time since resume.
>> Doesn't seem unreasonable to me.
>>> Again, if you have been sitting in DDB, what exactly is the  
>>> definition
>>> of "uptime" ?
>> Since the kernel is non-operational while in DDB, uptime is to
>> reset when leaving DDB. Again, according to the Wikipedia definition
>> of uptime. I'm having more problems finding this reasonable, but
>> it's not unacceptable.
>> The question therefore is: which definition of uptime do we try to
>> implement?
> The question is "up and running" since when?  Since the last
> interruption (suspend or ddb) or since the last initialization
> of the kernel (boot or reboot)?  IMO the latter minus the former
> in SI seconds.

I think the accepted property is that uptime is continuous. Put
differently: the Wikipedia definition defines uptime as the
opposite of downtime. Since downtime is non-qualified, there's
no distinction between boot, reboot, suspend or in-debugger.
Non-operational is non-operational.

Thus the question of "since when" can be answered as: the first
time it became operational after being non-operational.

Note also that the state of being non-operational is unqualified
as to its duration. It is, theoretically speaking, possible to
define a missed clock interrupt as having had a state of non-
operation because operation implies being able to service clock

  Marcel Moolenaar         USPA: A-39004          marcel at xcllnt.net

More information about the cvs-src mailing list