From owner-freebsd-current@FreeBSD.ORG Mon Oct 31 18:00:43 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0ED416A420; Mon, 31 Oct 2005 18:00:43 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from mail26.syd.optusnet.com.au (mail26.syd.optusnet.com.au [211.29.133.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8A5D43D46; Mon, 31 Oct 2005 18:00:42 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail26.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id j9VI0cJo008855 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 1 Nov 2005 05:00:40 +1100 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1]) by cirb503493.alcatel.com.au (8.12.10/8.12.10) with ESMTP id j9VI0cHh058565; Tue, 1 Nov 2005 05:00:38 +1100 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost) by cirb503493.alcatel.com.au (8.12.10/8.12.9/Submit) id j9VI0ciB058564; Tue, 1 Nov 2005 05:00:38 +1100 (EST) (envelope-from pjeremy) Date: Tue, 1 Nov 2005 05:00:37 +1100 From: Peter Jeremy To: Poul-Henning Kamp Message-ID: <20051031180037.GA39882@cirb503493.alcatel.com.au> References: <4365EF7B.1020706@freebsd.org> <81213.1130754398@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81213.1130754398@critter.freebsd.dk> User-Agent: Mutt/1.4.2.1i X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc Cc: freebsd-current@freebsd.org, David Xu Subject: Re: TSC instead of ACPI: powerd doesn't work anymore (to be expected?) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2005 18:00:44 -0000 On Mon, 2005-Oct-31 11:26:38 +0100, Poul-Henning Kamp wrote: >In message <4365EF7B.1020706@freebsd.org>, David Xu writes: >>We can introduce >>hrtime_t clock_gethrtime(clockid_t clock) to get hi-resolution time >>as the one seen in RTLinux, or gethrtime() as seen in Solaris (Daniel >>Eischen said?) ... >The open group specifically allow clock_gettime() to implement >more timescales, so what did those fools go and invent even more >library functions for ? gethrtime() dates back to SunOS 4.x and (AFAIK) predates TOG's work. ISTR it's not really a syscall but just reads the HR clock out of the magic page with the timer. I'd also support a move to make gettimeofday() a cheaper syscall that counts in 1/hz and require the use of clock_gettime() for accurate timestamps. This still leaves the issue of the scheduler - do we need an accurate (and expensive) record of how long a particular process executes? We can probably make the timestamps slightly cheaper to obtain since we only need to keep track of a time difference on a single CPU - there's no need for inter-CPU synchronisation (because a thread can't migrate from from CPU to CPU without the scheduler knowing). It probably doesn't even matter if the time intervals provided to the scheduler are inaccurate by a few percent or differ slightly between CPUs. -- Peter Jeremy