From: Jan Kiszka <jan.kiszka@siemens.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-trivial] [PATCH] rename get_clock_realtime
Date: Fri, 20 Jan 2012 12:29:07 +0100 [thread overview]
Message-ID: <4F195003.7050500@siemens.com> (raw)
In-Reply-To: <4F194F4E.9060901@redhat.com>
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<pbonzini@redhat.com>
>>> ---
>>> 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
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] rename get_clock_realtime
Date: Fri, 20 Jan 2012 12:29:07 +0100 [thread overview]
Message-ID: <4F195003.7050500@siemens.com> (raw)
In-Reply-To: <4F194F4E.9060901@redhat.com>
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<pbonzini@redhat.com>
>>> ---
>>> 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
next prev parent reply other threads:[~2012-01-20 11:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 11:05 [Qemu-trivial] [PATCH] rename get_clock_realtime Paolo Bonzini
2012-01-20 11:05 ` [Qemu-devel] " Paolo Bonzini
2012-01-20 11:17 ` [Qemu-trivial] " Jan Kiszka
2012-01-20 11:17 ` [Qemu-devel] " Jan Kiszka
2012-01-20 11:26 ` [Qemu-trivial] " Paolo Bonzini
2012-01-20 11:26 ` [Qemu-devel] " Paolo Bonzini
2012-01-20 11:28 ` [Qemu-devel] [PATCH v2] " Paolo Bonzini
2012-01-20 11:29 ` Jan Kiszka [this message]
2012-01-20 11:29 ` [Qemu-devel] [PATCH] " Jan Kiszka
2012-01-20 11:39 ` [Qemu-trivial] " Paolo Bonzini
2012-01-20 11:39 ` [Qemu-devel] " Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F195003.7050500@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.