mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
change all other clock references to use nanosecond resolution accessors
This was done with: sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. There was exactly one false positive in qemu_run_timers: - current_time = qemu_get_clock (clock); + current_time = qemu_get_clock_ns (clock); which is of course not in this patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7bd427d801
commit
7447545544
68 changed files with 268 additions and 268 deletions
12
qemu-timer.c
12
qemu-timer.c
|
@ -242,7 +242,7 @@ static void icount_adjust(void)
|
|||
return;
|
||||
|
||||
cur_time = cpu_get_clock();
|
||||
cur_icount = qemu_get_clock(vm_clock);
|
||||
cur_icount = qemu_get_clock_ns(vm_clock);
|
||||
delta = cur_icount - cur_time;
|
||||
/* FIXME: This is a very crude algorithm, somewhat prone to oscillation. */
|
||||
if (delta > 0
|
||||
|
@ -271,7 +271,7 @@ static void icount_adjust_rt(void * opaque)
|
|||
static void icount_adjust_vm(void * opaque)
|
||||
{
|
||||
qemu_mod_timer(icount_vm_timer,
|
||||
qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10);
|
||||
qemu_get_clock_ns(vm_clock) + get_ticks_per_sec() / 10);
|
||||
icount_adjust();
|
||||
}
|
||||
|
||||
|
@ -604,9 +604,9 @@ void configure_icount(const char *option)
|
|||
icount_rt_timer = qemu_new_timer_ms(rt_clock, icount_adjust_rt, NULL);
|
||||
qemu_mod_timer(icount_rt_timer,
|
||||
qemu_get_clock_ms(rt_clock) + 1000);
|
||||
icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL);
|
||||
icount_vm_timer = qemu_new_timer_ns(vm_clock, icount_adjust_vm, NULL);
|
||||
qemu_mod_timer(icount_vm_timer,
|
||||
qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10);
|
||||
qemu_get_clock_ns(vm_clock) + get_ticks_per_sec() / 10);
|
||||
}
|
||||
|
||||
void qemu_run_all_timers(void)
|
||||
|
@ -646,7 +646,7 @@ static void host_alarm_handler(int host_signum)
|
|||
static int64_t delta_min = INT64_MAX;
|
||||
static int64_t delta_max, delta_cum, last_clock, delta, ti;
|
||||
static int count;
|
||||
ti = qemu_get_clock(vm_clock);
|
||||
ti = qemu_get_clock_ns(vm_clock);
|
||||
if (last_clock != 0) {
|
||||
delta = ti - last_clock;
|
||||
if (delta < delta_min)
|
||||
|
@ -706,7 +706,7 @@ static int64_t qemu_next_alarm_deadline(void)
|
|||
|
||||
if (!use_icount && active_timers[QEMU_CLOCK_VIRTUAL]) {
|
||||
delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -
|
||||
qemu_get_clock(vm_clock);
|
||||
qemu_get_clock_ns(vm_clock);
|
||||
} else {
|
||||
delta = INT32_MAX;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue