From owner-cvs-src@FreeBSD.ORG Sat Oct 22 08:51:50 2005 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08EC016A41F; Sat, 22 Oct 2005 08:51:50 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5959C43D53; Sat, 22 Oct 2005 08:51:49 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id j9M8pljG016254; Sat, 22 Oct 2005 18:51:47 +1000 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id j9M8piR9005060; Sat, 22 Oct 2005 18:51:45 +1000 Date: Sat, 22 Oct 2005 18:51:44 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Poul-Henning Kamp In-Reply-To: <31104.1129915194@critter.freebsd.dk> Message-ID: <20051022175218.F8139@delplex.bde.org> References: <31104.1129915194@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Andre Oppermann , src-committers@freebsd.org, Andre Oppermann , cvs-all@freebsd.org, cvs-src@freebsd.org Subject: Re: Timekeeping [Was: Re: cvs commit: src/usr.bin/vmstat vmstat.c src/usr.bin/w w.c] X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2005 08:51:50 -0000 On Fri, 21 Oct 2005, Poul-Henning Kamp wrote: > In message <435921F1.5E9050AD@networx.ch>, Andre Oppermann writes: >>>> 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 can live with this definition. This is a good measure from the point of view of the users of the services. It is not quite right for statistics utilities like vmstat. But systat uses different units that end up being almost equivalent to monotonic time. It doesn't use any of boottime, time(3), gettimeofday(2) or clock_gettime(2); it uses on tick counts. Since the tick counts don't increase during suspend and ddb activity, the act in the same way as CLOCK_MONOTONIC except they are less accurate and are not slewed except for the physical slew from drift in the hardware clock that generates the clock interrupts. >>> So now we just need to be able to reliably measure the "not-uptime". >> >> Umm... Whenever the onesec tick is not incrementing the uptime (and >> monotonic) counter. Which conviniently already is the case when OS is >> suspended or in DDB. > > Uhm, yes. Only... > > How do we measure the time our clock does _not_ tick ? > > We need to use another clock for that. > > The RTC comes to mind, but it's precision leaves a lot to be > desired. It is more than enough except for short term "suspensions" (e.g., ones involving non-interactive single-stepping in ddb), and timecounters normally keep working across short term "suspensions". It's more of a problem that the system might not know when it is suspended or resumed, so it couldn't take the timestamps needed to decide when it wasn't running. As a worst case, suspend/resume might be per-cycle. Bruce