|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH 2/2] [RFC] time: refactor QEMU timer to use GHRTimer |
Date: | Tue, 23 Aug 2011 07:33:48 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10 |
On 08/23/2011 02:43 AM, Paolo Bonzini wrote:
On 08/22/2011 09:21 PM, Anthony Liguori wrote:- ticks = cpu_get_real_ticks(); - if (timers_state.cpu_ticks_prev > ticks) { - /* Note: non increasing ticks may happen if the host uses - software suspend */ - timers_state.cpu_ticks_offset += timers_state.cpu_ticks_prev - ticks; - } + ticks = get_clock(); [...] -static inline int64_t cpu_get_real_ticks(void) -{ - int64_t val; - asm volatile ("rdtsc" : "=A" (val)); - return val; -} -cpu_get_ticks is used also to emulate the guest TSC, are you sure you want to change that uniformly to a 1 GHz rate?
Where possible, CLOCK_MONOTONIC_RAW should be implemented in terms or rdtscp. It will provide the highest accuracy time source that you can get.
So I don't think there's any different in terms of timer granularity from using CLOCK_MONOTONIC_RAW and rdtsc directly other than the former is more correct.
Regards, Anthony Liguori
I had some more cleanups in this area, I'll try to get them tested and submitted but I have little time for this right now. Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |