Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Oct 2005 19:27:57 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Andre Oppermann <andre@freebsd.org>
Cc:        cvs-src@freebsd.org, Poul-Henning Kamp <phk@phk.freebsd.dk>, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: Timekeeping [Was: Re: cvs commit: src/usr.bin/vmstat vmstat.c  src/usr.bin/w w.c]
Message-ID:  <20051022185422.Q8268@delplex.bde.org>
In-Reply-To: <435913FE.774C683D@freebsd.org>
References:  <30805.1129910750@critter.freebsd.dk> <435913FE.774C683D@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 21 Oct 2005, Andre Oppermann wrote:

> Poul-Henning Kamp wrote:
>> Again, if you have been sitting in DDB, what exactly is the definition
>> of "uptime" ?
>
> IMO it's this:
>
> Uptime is the time the operating was available to present it's common
> services to userland.  That excludes any suspend and ddb times.  Single
> user mode however counts because the OS was servicing userland even if
> there was only one user.  Uptime is represented in SI seconds.

I agree for suspend and ddb, but not for single user mode.  The system
can be shut down to single user mode and restarted without rebooting.
Restarting runs /etc/rc etc.  The system can hardly be considered to
be up until /etc/rc has completed, but we've never bother breaking
boottime of providing a beginning-of-uptime variable to give the
actual start of uptime.  SIngle user mode is even more clearly down
for remote services, but ruptime doesn't understand this.  I don't
really understand the protocol, but ruptime seems to just talk to
rwhod; rwhod never understood the difference between local and remote
uptime and just uses the kernel boottime like w used to.

> Time since boottime is the UTC delta from the time of when the OS
> initialized itself to now.  Leap seconds cause deviations from uptime.
> Time since boottime is represented as numerical delta in seconds from
> two UTC timestamps.

What's a UTC delta?  Deltas don't (shouldn't) depend on the calendar.
Leap seconds shouldn't cause deviations.  They don't now, since
boottime is broken (set backwards) to compensate for them.  What are
numerical deltas and UTC timestamps?  In C99, there are only time_t's
in some scale and difftime() to not-necessarily-numerically subtract
them.  In POSIX, using difftime() is essential sonce the broken scale
breaks mainly numerical differences.

> Uptime != Time since boottime.

Only because the correct base point is not the boot time.  We still use
boottime for the base, so CLOCK_MONOTONIC only gives a different value
due to bugs.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051022185422.Q8268>