summaryrefslogtreecommitdiff
path: root/qemu-timer.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-03-11 16:33:58 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2011-03-21 09:23:23 +0100
commit4a998740b22aa673ea475060c787da7c545588cf (patch)
tree0bb1de0638c3dadafea4be2adeb5a071a4af8da4 /qemu-timer.h
parent74475455442398a64355428b37422d14ccc293cb (diff)
downloadqemu-4a998740b22aa673ea475060c787da7c545588cf.tar.gz
add a generic scaling mechanism for timers
This enables rt_clock timers to use nanosecond resolution, just by using the _ns functions; there is really no reason to forbid that. Migrated timers are all using vm_clock (of course; but I checked that anyway) so the timers in the savevm files are already in nanosecond resolution. So this patch makes no change to the migration format. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-timer.h')
-rw-r--r--qemu-timer.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/qemu-timer.h b/qemu-timer.h
index 345feeabc0..0ea77fb767 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -41,7 +41,8 @@ int64_t qemu_get_clock(QEMUClock *clock);
int64_t qemu_get_clock_ns(QEMUClock *clock);
void qemu_clock_enable(QEMUClock *clock, int enabled);
-QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);
+QEMUTimer *qemu_new_timer(QEMUClock *clock, int scale,
+ QEMUTimerCB *cb, void *opaque);
void qemu_free_timer(QEMUTimer *ts);
void qemu_del_timer(QEMUTimer *ts);
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
@@ -61,15 +62,13 @@ void quit_timers(void);
static inline QEMUTimer *qemu_new_timer_ns(QEMUClock *clock, QEMUTimerCB *cb,
void *opaque)
{
- assert(clock != rt_clock);
- return qemu_new_timer(clock, cb, opaque);
+ return qemu_new_timer(clock, SCALE_NS, cb, opaque);
}
static inline QEMUTimer *qemu_new_timer_ms(QEMUClock *clock, QEMUTimerCB *cb,
void *opaque)
{
- assert(clock == rt_clock);
- return qemu_new_timer(clock, cb, opaque);
+ return qemu_new_timer(clock, SCALE_MS, cb, opaque);
}
static inline int64_t qemu_get_clock_ms(QEMUClock *clock)