From owner-freebsd-current@FreeBSD.ORG Mon Oct 31 10:48:39 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 5EB2916A420; Mon, 31 Oct 2005 10:48:39 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2592243D45; Mon, 31 Oct 2005 10:48:39 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9VAmaC0006665; Mon, 31 Oct 2005 10:48:37 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4365F687.3070105@freebsd.org> Date: Mon, 31 Oct 2005 18:48:39 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20050928 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Poul-Henning Kamp References: <81213.1130754398@critter.freebsd.dk> In-Reply-To: <81213.1130754398@critter.freebsd.dk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Leidinger , freebsd-current@freebsd.org, Robert Watson 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 10:48:39 -0000 Poul-Henning Kamp wrote: > In message <4365EF7B.1020706@freebsd.org>, David Xu writes: >>Can we change gettimeofday and clock_gettime to lower resolution now? > > > I can live with gettimeofday(2) and time(3) being degraded. > > I am going to insist that clock_gettime(CLOCK_REALTIME, CLOCK_UPTIME) > remain precise. > In thread program, we have to use clock_gettime, for example a thread wants to wait for condition variable for two seconds, it has to: struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec += 2; pthread_cond_wait(&cond, &mtx); problem is who really cares time precise? how many people are really handling realtime critical tasks? this is really an unpleasant side effect that a simple syscall can stall cpu. > >>I think 1000hz/s is enough for most applications, since a thread can >>never sleep shorter than a tick for years. > > > (Famous last words!) > > Time is not just a matter of sleeping. > > >>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?) > > > You know ? > > This is just a great example of why people feel the autocrap tools > is the way to write portable code :-( > > The open group specifically allow clock_gettime() to implement > more timescales, so what did those fools go and invent even more > library functions for ? > > Poul-Henning > You can introduce other CLOCK_..., but auto tools won't detect them too, this means nobody will use them except us, probably worse then gethrtime. :-(