All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vesa Jääskeläinen" <chaac@nic.fi>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Higher resolution timers
Date: Sat, 24 May 2008 18:25:06 +0300	[thread overview]
Message-ID: <48383352.3000801@nic.fi> (raw)
In-Reply-To: <87fxs98cms.fsf@xs4all.nl>

Marco Gerards wrote:
> Hi Colin,
> 
> Colin D Bennett <colin@gibibit.com> 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.




      reply	other threads:[~2008-05-24 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-12 16:33 Higher resolution timers Colin D Bennett
2008-05-14 16:26 ` Vesa Jääskeläinen
2008-05-18 16:27 ` Vesa Jääskeläinen
2008-05-20 17:20   ` Colin D Bennett
2008-05-20 17:46 ` Colin D Bennett
2008-05-23 11:55   ` Marco Gerards
2008-05-23 14:28     ` Colin D Bennett
2008-05-24  9:23       ` Marco Gerards
2008-05-28 13:43         ` Robert Millan
2008-05-23 11:48 ` Marco Gerards
2008-05-24 15:25   ` Vesa Jääskeläinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48383352.3000801@nic.fi \
    --to=chaac@nic.fi \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.