]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Wed, 26 Nov 2014 10:40:50 +0000 (13:40 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Dec 2014 11:21:02 +0000 (12:21 +0100)
This patch introduces new QEMU_CLOCK_VIRTUAL_RT clock, which
should be used for icount warping.  In the next patch, it
will be used to avoid a huge icount warp when a virtual
machine is stopped for a long time.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/timer.h
qemu-timer.c

index 3dae414f40a668fa047595c1ff3e4c526f83740f..552487c45fa6c70cc35ea8c4097e7ceb4ef733c2 100644 (file)
  * is suspended, and it will reflect system time changes the host may
  * undergo (e.g. due to NTP). The host clock has the same precision as
  * the virtual clock.
+ *
+ * @QEMU_CLOCK_VIRTUAL_RT: realtime clock used for icount warp
+ *
+ * Outside icount mode, this clock is the same as @QEMU_CLOCK_VIRTUAL.
+ * In icount mode, this clock counts nanoseconds while the virtual
+ * machine is running.
  */
 
 typedef enum {
     QEMU_CLOCK_REALTIME = 0,
     QEMU_CLOCK_VIRTUAL = 1,
     QEMU_CLOCK_HOST = 2,
+    QEMU_CLOCK_VIRTUAL_RT = 3,
     QEMU_CLOCK_MAX
 } QEMUClockType;
 
index 00a5d35c3f64f5c9a65a5ade0e85273e3555e5c0..f4b4b6aa455dae2d1c3ac417782798ec40950d76 100644 (file)
@@ -566,6 +566,8 @@ int64_t qemu_clock_get_ns(QEMUClockType type)
             notifier_list_notify(&clock->reset_notifiers, &now);
         }
         return now;
+    case QEMU_CLOCK_VIRTUAL_RT:
+        return cpu_get_clock();
     }
 }