Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JzvcI-00063e-OO for mharc-grub-devel@gnu.org; Sat, 24 May 2008 11:25:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JzvcG-0005zV-BF for grub-devel@gnu.org; Sat, 24 May 2008 11:25:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JzvcE-0005wC-Iv for grub-devel@gnu.org; Sat, 24 May 2008 11:25:03 -0400 Received: from [199.232.76.173] (port=49630 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JzvcE-0005w2-Bp for grub-devel@gnu.org; Sat, 24 May 2008 11:25:02 -0400 Received: from [195.156.147.13] (port=42388 helo=kirsi2.rokki.sonera.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JzvcD-0007aw-TX for grub-devel@gnu.org; Sat, 24 May 2008 11:25:02 -0400 Received: from [127.0.0.1] (88.193.32.97) by kirsi2.rokki.sonera.fi (8.5.014) id 482C7FD600665D99 for grub-devel@gnu.org; Sat, 24 May 2008 18:25:00 +0300 Message-ID: <48383352.3000801@nic.fi> Date: Sat, 24 May 2008 18:25:06 +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> <87fxs98cms.fsf@xs4all.nl> In-Reply-To: <87fxs98cms.fsf@xs4all.nl> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Sat, 24 May 2008 15:25:04 -0000 Marco Gerards wrote: > Hi Colin, > > Colin D Bennett writes: >> What would be the best way to do this? Possibilities that I am aware of >> are: >> * RDTSC instruction (must calibrate with RTC at startup?) >> * HPET (complex to use?) >> * RTC (can we set the timer interrupt rate to >18 Hz?) >> >> Does anyone have any thoughts on these options? >> >> 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. > > Only something that really returns a time seems like a good choise to > me. AFAIK RDTSC returns clock cycles that passed since the system was > switched on. This means that code will run faster on a processor with > a higher clock speed. Am I mistaken? That's way you calibrate it :) Then you can get pretty good accuracy :) > So I prefer something that can be used to wait a microsecond and not a > certain amount of clock cycles. Using the RTC seems a good choice, > but we have to keep in mind the BIOS uses it as well. Default rate for RTC is bad for any accuracy. At least in this case. > > Isn't HPET only available on newer processors? Yes. But the idea is to use best possible resolution available. So if choice A is not there then fallback for choice B. Of course in some cases animation will not be so smooth. But at least it will work.