diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-12-08 12:35:25 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-01-19 12:28:59 +0100 |
commit | 8e98c27daacba2fac0cb868f905489b9a744a152 (patch) | |
tree | c19e514413c554a39e965d2ccaec8780816ea35f /accel | |
parent | f07f246734e271b368bfc9afc4cbc437999d58ea (diff) | |
download | qemu-8e98c27daacba2fac0cb868f905489b9a744a152.zip qemu-8e98c27daacba2fac0cb868f905489b9a744a152.tar.gz qemu-8e98c27daacba2fac0cb868f905489b9a744a152.tar.bz2 |
system/cpu-timers: Introduce ICountMode enumerator
Rather than having to lookup for what the 0, 1, 2, ...
icount values are, use a enum definition.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20231208113529.74067-4-philmd@linaro.org>
Diffstat (limited to 'accel')
-rw-r--r-- | accel/tcg/icount-common.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c index dc69d6a..f0f8fc7 100644 --- a/accel/tcg/icount-common.c +++ b/accel/tcg/icount-common.c @@ -49,21 +49,19 @@ static bool icount_sleep = true; /* Arbitrarily pick 1MIPS as the minimum allowable speed. */ #define MAX_ICOUNT_SHIFT 10 -/* - * 0 = Do not count executed instructions. - * 1 = Fixed conversion of insn to ns via "shift" option - * 2 = Runtime adaptive algorithm to compute shift - */ -int use_icount; +/* Do not count executed instructions */ +ICountMode use_icount = ICOUNT_DISABLED; static void icount_enable_precise(void) { - use_icount = 1; + /* Fixed conversion of insn to ns via "shift" option */ + use_icount = ICOUNT_PRECISE; } static void icount_enable_adaptive(void) { - use_icount = 2; + /* Runtime adaptive algorithm to compute shift */ + use_icount = ICOUNT_ADAPTATIVE; } /* @@ -256,7 +254,7 @@ static void icount_warp_rt(void) int64_t warp_delta; warp_delta = clock - timers_state.vm_clock_warp_start; - if (icount_enabled() == 2) { + if (icount_enabled() == ICOUNT_ADAPTATIVE) { /* * In adaptive mode, do not let QEMU_CLOCK_VIRTUAL run too far * ahead of real time (it might already be ahead so careful not |