[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/19] new function qemu_icount_delta
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 12/19] new function qemu_icount_delta |
Date: |
Mon, 21 Dec 2009 09:09:23 +0100 |
Tweaking the rounding in qemu_next_deadline ensures that there's
no change whatsoever.
Signed-off-by: Paolo Bonzini <address@hidden>
---
vl.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/vl.c b/vl.c
index 289aadc..9f363c8 100644
--- a/vl.c
+++ b/vl.c
@@ -525,6 +525,20 @@ static int64_t cpu_get_clock(void)
}
}
+static int64_t qemu_icount_delta(void)
+{
+ if (!use_icount) {
+ return 5000 * (int64_t) 1000000;
+ } else if (use_icount == 1) {
+ /* When not using an adaptive execution frequency
+ we tend to get badly out of sync with real time,
+ so just delay for a reasonable amount of time. */
+ return 0;
+ } else {
+ return cpu_get_icount() - cpu_get_clock();
+ }
+}
+
/* enable cpu_get_ticks() */
void cpu_enable_ticks(void)
{
@@ -3940,25 +3954,16 @@ static int qemu_calculate_timeout(void)
timeout = 5000;
else if (tcg_has_work())
timeout = 0;
- else if (!use_icount)
- timeout = 5000;
else {
/* XXX: use timeout computed from timers */
int64_t add;
int64_t delta;
/* Advance virtual time to the next event. */
- if (use_icount == 1) {
- /* When not using an adaptive execution frequency
- we tend to get badly out of sync with real time,
- so just delay for a reasonable amount of time. */
- delta = 0;
- } else {
- delta = cpu_get_icount() - cpu_get_clock();
- }
+ delta = qemu_icount_delta();
if (delta > 0) {
/* If virtual time is ahead of real time then just
wait for IO. */
- timeout = (delta / 1000000) + 1;
+ timeout = (delta + 999999) / 1000000;
} else {
/* Wait for either IO to occur or the next
timer event. */
--
1.6.5.2
- Re: [Qemu-devel] [PATCH 11/19] use a bottom half to run timers, (continued)
[Qemu-devel] [PATCH 10/19] add qemu_bh_scheduled, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 06/19] more alarm timer cleanup, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 16/19] tweak qemu_notify_event, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 13/19] move tcg_has_work to cpu-exec.c and rename it, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 12/19] new function qemu_icount_delta,
Paolo Bonzini <=
[Qemu-devel] [PATCH 15/19] do not provide qemu_event_increment if iothread not used, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 14/19] disentangle tcg and deadline calculation, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 18/19] introduce qemu_clock_enable, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 17/19] move vmstate registration of vmstate_timers earlier, Paolo Bonzini, 2009/12/21
[Qemu-devel] [PATCH 19/19] split out qemu-timer.c, Paolo Bonzini, 2009/12/21