]> git.proxmox.com Git - qemu.git/commitdiff
icount: use cpu_get_icount() directly
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 7 Oct 2013 15:21:51 +0000 (17:21 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Oct 2013 15:31:00 +0000 (17:31 +0200)
This will help later when we will have to place these calls in
a critical section, and thus call a version of cpu_get_icount()
that does not take the lock.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cpus.c

diff --git a/cpus.c b/cpus.c
index f07533530c0453e0506ff65edf081dbf527da4d0..a2d09f363f38e8834746730fb55f478b0aa20eb9 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -236,12 +236,15 @@ static void icount_adjust(void)
     int64_t cur_icount;
     int64_t delta;
     static int64_t last_delta;
+
     /* If the VM is not running, then do nothing.  */
     if (!runstate_is_running()) {
         return;
     }
+
     cur_time = cpu_get_clock();
-    cur_icount = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+    cur_icount = cpu_get_icount();
+
     delta = cur_icount - cur_time;
     /* FIXME: This is a very crude algorithm, somewhat prone to oscillation.  */
     if (delta > 0
@@ -297,7 +300,7 @@ static void icount_warp_rt(void *opaque)
              * far ahead of real time.
              */
             int64_t cur_time = cpu_get_clock();
-            int64_t cur_icount = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+            int64_t cur_icount = cpu_get_icount();
             int64_t delta = cur_time - cur_icount;
             qemu_icount_bias += MIN(warp_delta, delta);
         }