qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] rename get_clock_realtime


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH] rename get_clock_realtime
Date: Fri, 20 Jan 2012 12:29:07 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-01-20 12:26, Paolo Bonzini wrote:
> On 01/20/2012 12:17 PM, Jan Kiszka wrote:
>> On 2012-01-20 12:05, Paolo Bonzini wrote:
>>> get_clock_realtime accesses the host_clock, not the rt_clock.
>>>
>>> Signed-off-by: Paolo Bonzini<address@hidden>
>>> ---
>>>   qemu-timer.c |    2 +-
>>>   qemu-timer.h |    4 ++--
>>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/qemu-timer.c b/qemu-timer.c
>>> index cd026c6..4a14a6d 100644
>>> --- a/qemu-timer.c
>>> +++ b/qemu-timer.c
>>> @@ -436,7 +436,7 @@ int64_t qemu_get_clock_ns(QEMUClock *clock)
>>>               return cpu_get_clock();
>>>           }
>>>       case QEMU_CLOCK_HOST:
>>> -        now = get_clock_realtime();
>>> +        now = get_clock_host();
>>>           last = clock->last;
>>>           clock->last = now;
>>>           if (now<  last) {
>>> diff --git a/qemu-timer.h b/qemu-timer.h
>>> index de17f3b..b180fca 100644
>>> --- a/qemu-timer.h
>>> +++ b/qemu-timer.h
>>> @@ -93,7 +93,7 @@ static inline int64_t get_ticks_per_sec(void)
>>>   }
>>>
>>>   /* real time host monotonic timer */
>>> -static inline int64_t get_clock_realtime(void)
>>> +static inline int64_t get_clock_host(void)
>>
>> It accesses the host realtime clock, so get_clock_host_realtime would be
>> optimal. In that light, the comment above should be fixed as well.
> 
> Yeah, however, realtime is quite confusing because CLOCK_MONOTONIC is 
> part of the "real-time clock API".  The code is much clearer than the 
> comment, I'll remove it completely.  v2 on the way.

There is CLOCK_MONOTONIC and CLOCK_REALTIME, and this function uses the
latter.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



reply via email to

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