From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Jxliw-0000qG-LX for mharc-grub-devel@gnu.org; Sun, 18 May 2008 12:27:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jxliu-0000pE-UT for grub-devel@gnu.org; Sun, 18 May 2008 12:27:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jxlit-0000oe-Pn for grub-devel@gnu.org; Sun, 18 May 2008 12:27:00 -0400 Received: from [199.232.76.173] (port=58865 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jxlit-0000oV-K6 for grub-devel@gnu.org; Sun, 18 May 2008 12:26:59 -0400 Received: from mta-out.inet.fi ([195.156.147.13]:32955 helo=kirsi1.rokki.sonera.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jxlis-0003Kd-DF for grub-devel@gnu.org; Sun, 18 May 2008 12:26:58 -0400 Received: from [127.0.0.1] (88.193.32.97) by kirsi1.rokki.sonera.fi (8.5.014) id 482C3681002156F3 for grub-devel@gnu.org; Sun, 18 May 2008 19:26:54 +0300 Message-ID: <483058D9.6060701@nic.fi> Date: Sun, 18 May 2008 19:27:05 +0300 From: =?ISO-8859-1?Q?Vesa_J=E4=E4skel=E4inen?= User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: The development of GRUB 2 References: <20080512093354.2770e1cf@gibibit.com> In-Reply-To: <20080512093354.2770e1cf@gibibit.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: Quoted-Printable X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: Higher resolution timers X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 May 2008 16:27:01 -0000 Colin D Bennett wrote: > To implement a nice GUI with some animations, it will be important to > have a timer with a better resolution than 1/18 second (which appears > to be the current GRUB timer resolution on the PC). >=20 > What would be the best way to do this? Possibilities that I am aware of > are:=20 > * RDTSC instruction (must calibrate with RTC at startup?) > * HPET (complex to use?) > * RTC (can we set the timer interrupt rate to >18 Hz?) >=20 > Does anyone have any thoughts on these options? >=20 > I think that using the TSC (w/ RDTSC instruction) and calibrating it > with a quick 2-3 RTC tick loop at startup might be the easiest option. Hi Colin, What kind of accuracy would you need? I am just wondering if you just define function like: grub_uint64_t grub_timer_[nu]time(void); This could return time in nanoseconds, or microseconds from epoch. Then during grub init you would call some platform function to=20 initialize time (calibrate when using rdtsc), and set proper offset=20 value so you get correct time when asking for time. On every system it=20 would return time in this format, but granularity would be different. This could be: void grub_timer_init(void) What do you think? Thanks, Vesa J=E4=E4skel=E4inen