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
