From 740b175973427bcfa32ad894bb1f83b96d184c28 Mon Sep 17 00:00:00 2001 From: Claudio Fontana Date: Wed, 19 Aug 2020 13:17:19 +0200 Subject: cpu-timers, icount: new modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactoring of cpus.c continues with cpu timer state extraction. cpu-timers: responsible for the softmmu cpu timers state, including cpu clocks and ticks. icount: counts the TCG instructions executed. As such it is specific to the TCG accelerator. Therefore, it is built only under CONFIG_TCG. One complication is due to qtest, which uses an icount field to warp time as part of qtest (qtest_clock_warp). In order to solve this problem, provide a separate counter for qtest. This requires fixing assumptions scattered in the code that qtest_enabled() implies icount_enabled(), checking each specific case. Signed-off-by: Claudio Fontana Reviewed-by: Richard Henderson [remove redundant initialization with qemu_spice_init] Reviewed-by: Alex Bennée [fix lingering calls to icount_get] Signed-off-by: Claudio Fontana Signed-off-by: Paolo Bonzini --- tests/ptimer-test-stubs.c | 5 +++-- tests/test-timed-average.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/ptimer-test-stubs.c b/tests/ptimer-test-stubs.c index ed393d9..e935a13 100644 --- a/tests/ptimer-test-stubs.c +++ b/tests/ptimer-test-stubs.c @@ -12,6 +12,7 @@ #include "qemu/main-loop.h" #include "sysemu/replay.h" #include "migration/vmstate.h" +#include "sysemu/cpu-timers.h" #include "ptimer-test.h" @@ -30,8 +31,8 @@ QEMUTimerListGroup main_loop_tlg; int64_t ptimer_test_time_ns; -/* Do not artificially limit period - see hw/core/ptimer.c. */ -int use_icount = 1; +/* under qtest_enabled(), will not artificially limit period - see hw/core/ptimer.c. */ +int use_icount; bool qtest_allowed; void timer_init_full(QEMUTimer *ts, diff --git a/tests/test-timed-average.c b/tests/test-timed-average.c index e2bcf5f..82c9250 100644 --- a/tests/test-timed-average.c +++ b/tests/test-timed-average.c @@ -11,7 +11,7 @@ */ #include "qemu/osdep.h" - +#include "sysemu/cpu-timers.h" #include "qemu/timed-average.h" /* This is the clock for QEMU_CLOCK_VIRTUAL */ -- cgit v1.1