grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Higher resolution timers


From: Vesa Jääskeläinen
Subject: Re: Higher resolution timers
Date: Sun, 18 May 2008 19:27:05 +0300
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

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).

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.

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 initialize time (calibrate when using rdtsc), and set proper offset value so you get correct time when asking for time. On every system it 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ääskeläinen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]