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>
This commit is contained in:
Philippe Mathieu-Daudé 2023-12-08 12:35:25 +01:00
parent f07f246734
commit 8e98c27daa
5 changed files with 24 additions and 19 deletions

View file

@ -17,18 +17,24 @@ void cpu_timers_init(void);
/* icount - Instruction Counter API */
/*
* icount enablement state:
/**
* ICountMode: icount enablement state:
*
* 0 = Disabled - Do not count executed instructions.
* 1 = Enabled - Fixed conversion of insn to ns via "shift" option
* 2 = Enabled - Runtime adaptive algorithm to compute shift
* @ICOUNT_DISABLED: Disabled - Do not count executed instructions.
* @ICOUNT_PRECISE: Enabled - Fixed conversion of insn to ns via "shift" option
* @ICOUNT_ADAPTATIVE: Enabled - Runtime adaptive algorithm to compute shift
*/
typedef enum {
ICOUNT_DISABLED = 0,
ICOUNT_PRECISE,
ICOUNT_ADAPTATIVE,
} ICountMode;
#ifdef CONFIG_TCG
extern int use_icount;
extern ICountMode use_icount;
#define icount_enabled() (use_icount)
#else
#define icount_enabled() 0
#define icount_enabled() ICOUNT_DISABLED
#endif
/*