On 01/23/2012 01:12 AM, Michael Roth wrote:
I'd looked into timer queues, which the developer docs suggested had
deprecated the use of mm timers, but I came across this which I figured
was why mm was preferred (%30 average error for a 50ms periodic/oneshot)
by the QEMU code:
http://www.virtualdub.org/blog/pivot/entry.php?id=272
Apparently Windows 7 has some fixes for drift that makes them reasonable
for a clock source, but still fairly low-res for an event timer.
On the other hand, timeBeginPeriod affect basically all time sources,
not just MM timers. Using timer queues together with timeBeginPeriod
might work, after all. However, it's not too interesting since
timeBeginPeriod is what causes the additional CPU usage.
What is interesting is to move timeBeginPeriod/timeEndPeriod from
qemu-timer.c elsewhere so that only QEMU uses it. The tools do not need
precise timekeeping anyway.
But while that would be good to have later when more tools use the
shared main loop, your patch is still good for now.
Paolo