From owner-freebsd-current@FreeBSD.ORG Fri Oct 28 17:24:46 2005 Return-Path: X-Original-To: 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 F227F16A420; Fri, 28 Oct 2005 17:24:45 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2CC2943D6D; Fri, 28 Oct 2005 17:24:31 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from localhost (localhost [127.0.0.1]) by pi.codefab.com (Postfix) with ESMTP id 422EB5DAE; Fri, 28 Oct 2005 13:24:31 -0400 (EDT) Received: from pi.codefab.com ([127.0.0.1]) by localhost (pi.codefab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31906-02; Fri, 28 Oct 2005 13:24:30 -0400 (EDT) Received: from [192.168.1.3] (pool-68-161-122-227.ny325.east.verizon.net [68.161.122.227]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pi.codefab.com (Postfix) with ESMTP id 292455C53; Fri, 28 Oct 2005 13:24:30 -0400 (EDT) Message-ID: <43625ECE.7010804@mac.com> Date: Fri, 28 Oct 2005 13:24:30 -0400 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Robert Watson References: <32412.1130505646@critter.freebsd.dk> <436229CF.6040001@freebsd.org> <20051028144307.X53858@fledge.watson.org> In-Reply-To: <20051028144307.X53858@fledge.watson.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at codefab.com Cc: Poul-Henning Kamp , David Xu , current@freebsd.org Subject: Re: Timers and timing, was: MySQL Performance 6.0rc1 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: Fri, 28 Oct 2005 17:24:46 -0000 Robert Watson wrote: > On Fri, 28 Oct 2005, David Xu wrote: >> Poul-Henning Kamp wrote: >>>> On the other hand, a lower risk change might be to simply add a new >>>> CLOCK_ type for lower resolution, and have a timer synchronize a >>>> variable to the system clock once every 1/10 of a second. This >>>> avoids having to muck with VM layout, etc. >>> >>> Is the CLOCK_* namespace ours to muck about with in the first place? >>> >> I prefer this way, can you implement it? The global page idea is a >> complex, someone can slowly work on it, there are many things can be >> done, for example, fast syscall using sysenter/sysexit. > > I'm happy to take a stab at this. > > We still need someone to grab the context switch time keeping by the > horns and Do Something, though. If I understand what was said earlier, the getmicrotime() kernel function ought to maintain the time at "(~ 1 msec)" precision. Could getmicrotime() be exported as a syscall, so that we could do something like this: --- lib/libc/gen/time.c~ Fri Jul 18 22:53:46 2003 +++ lib/libc/gen/time.c Fri Oct 28 13:04:26 2005 @@ -47,7 +47,8 @@ struct timeval tt; time_t retval; - if (gettimeofday(&tt, (struct timezone *)0) < 0) + getmicrotime(&tt); + if (tt.tv_sec == 0) retval = -1; else retval = tt.tv_sec; Note that this might even cause time(2) to return an error if the system is using dummyclock, which could be considered a feature. :-) -- -Chuck