* [Qemu-trivial] [PATCH] rename get_clock_realtime @ 2012-01-20 11:05 ` Paolo Bonzini 0 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:05 UTC (permalink / raw) To: qemu-devel; +Cc: qemu-trivial 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) { struct timeval tv; @@ -131,7 +131,7 @@ static inline int64_t get_clock(void) { /* XXX: using gettimeofday leads to problems if the date changes, so it should be avoided. */ - return get_clock_realtime(); + return get_clock_host(); } } #endif -- 1.7.7.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH] rename get_clock_realtime @ 2012-01-20 11:05 ` Paolo Bonzini 0 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:05 UTC (permalink / raw) To: qemu-devel; +Cc: qemu-trivial 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) { struct timeval tv; @@ -131,7 +131,7 @@ static inline int64_t get_clock(void) { /* XXX: using gettimeofday leads to problems if the date changes, so it should be avoided. */ - return get_clock_realtime(); + return get_clock_host(); } } #endif -- 1.7.7.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-trivial] [PATCH] rename get_clock_realtime 2012-01-20 11:05 ` [Qemu-devel] " Paolo Bonzini @ 2012-01-20 11:17 ` Jan Kiszka -1 siblings, 0 replies; 11+ messages in thread From: Jan Kiszka @ 2012-01-20 11:17 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-trivial, qemu-devel 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. Jan > { > struct timeval tv; > > @@ -131,7 +131,7 @@ static inline int64_t get_clock(void) > { > /* XXX: using gettimeofday leads to problems if the date > changes, so it should be avoided. */ > - return get_clock_realtime(); > + return get_clock_host(); > } > } > #endif -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH] rename get_clock_realtime @ 2012-01-20 11:17 ` Jan Kiszka 0 siblings, 0 replies; 11+ messages in thread From: Jan Kiszka @ 2012-01-20 11:17 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-trivial, qemu-devel 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. Jan > { > struct timeval tv; > > @@ -131,7 +131,7 @@ static inline int64_t get_clock(void) > { > /* XXX: using gettimeofday leads to problems if the date > changes, so it should be avoided. */ > - return get_clock_realtime(); > + return get_clock_host(); > } > } > #endif -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-trivial] [PATCH] rename get_clock_realtime 2012-01-20 11:17 ` [Qemu-devel] " Jan Kiszka @ 2012-01-20 11:26 ` Paolo Bonzini -1 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:26 UTC (permalink / raw) To: Jan Kiszka; +Cc: qemu-trivial, qemu-devel 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. Paolo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH] rename get_clock_realtime @ 2012-01-20 11:26 ` Paolo Bonzini 0 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:26 UTC (permalink / raw) To: Jan Kiszka; +Cc: qemu-trivial, qemu-devel 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. Paolo ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH v2] rename get_clock_realtime 2012-01-20 11:26 ` [Qemu-devel] " Paolo Bonzini (?) @ 2012-01-20 11:28 ` Paolo Bonzini -1 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:28 UTC (permalink / raw) To: qemu-devel; +Cc: Jan Kiszka get_clock_realtime accesses the host_clock, not the rt_clock. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- v1->v2: remove incorrect comment qemu-timer.c | 2 +- qemu-timer.h | 5 ++--- 2 files changed, 3 insertions(+), 4 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..a61f209 100644 --- a/qemu-timer.h +++ b/qemu-timer.h @@ -92,8 +92,7 @@ static inline int64_t get_ticks_per_sec(void) return 1000000000LL; } -/* real time host monotonic timer */ -static inline int64_t get_clock_realtime(void) +static inline int64_t get_clock_host(void) { struct timeval tv; @@ -131,7 +130,7 @@ static inline int64_t get_clock(void) { /* XXX: using gettimeofday leads to problems if the date changes, so it should be avoided. */ - return get_clock_realtime(); + return get_clock_host(); } } #endif -- 1.7.7.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-trivial] [PATCH] rename get_clock_realtime 2012-01-20 11:26 ` [Qemu-devel] " Paolo Bonzini @ 2012-01-20 11:29 ` Jan Kiszka -1 siblings, 0 replies; 11+ messages in thread From: Jan Kiszka @ 2012-01-20 11:29 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH] rename get_clock_realtime @ 2012-01-20 11:29 ` Jan Kiszka 0 siblings, 0 replies; 11+ messages in thread From: Jan Kiszka @ 2012-01-20 11:29 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-trivial] [PATCH] rename get_clock_realtime 2012-01-20 11:29 ` [Qemu-devel] " Jan Kiszka @ 2012-01-20 11:39 ` Paolo Bonzini -1 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:39 UTC (permalink / raw) To: Jan Kiszka, qemu-devel, qemu-trivial On 01/20/2012 12:29 PM, Jan Kiszka wrote: >> > 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. Actually it uses gettimeofday, but I see what you mean. But QEMU_CLOCK_REALTIME and rt_clock refer to CLOCK_MONOTONIC and are _not_ read by get_clock_realtime. This actually is what prompted me to rename get_clock_realtime (see commit message). Paolo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH] rename get_clock_realtime @ 2012-01-20 11:39 ` Paolo Bonzini 0 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2012-01-20 11:39 UTC (permalink / raw) To: Jan Kiszka, qemu-devel, qemu-trivial On 01/20/2012 12:29 PM, Jan Kiszka wrote: >> > 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. Actually it uses gettimeofday, but I see what you mean. But QEMU_CLOCK_REALTIME and rt_clock refer to CLOCK_MONOTONIC and are _not_ read by get_clock_realtime. This actually is what prompted me to rename get_clock_realtime (see commit message). Paolo ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-01-20 11:39 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [Qemu-trivial] [PATCH] " Jan Kiszka 2012-01-20 11:29 ` [Qemu-devel] " Jan Kiszka 2012-01-20 11:39 ` [Qemu-trivial] " Paolo Bonzini 2012-01-20 11:39 ` [Qemu-devel] " Paolo Bonzini
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.