Received: from eggs.gnu.org ([2001:4830:134:3::10]:58536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0YgS-0006cM-QN for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0YgN-0005Fo-GU for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0YgN-0005Fe-9N for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:39 -0500 From: Paolo Bonzini Date: Mon, 15 Dec 2014 17:38:14 +0100 Message-Id: <1418661511-22348-31-git-send-email-pbonzini@redhat.com> In-Reply-To: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> References: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 30/47] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pavel Dovgalyuk From: Pavel Dovgalyuk 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 Signed-off-by: Paolo Bonzini --- include/qemu/timer.h | 7 +++++++ qemu-timer.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 3dae414..552487c 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -36,12 +36,19 @@ * 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; diff --git a/qemu-timer.c b/qemu-timer.c index 00a5d35..f4b4b6a 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -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(); } } -- 1.8.3.1