From fceffb7d4aa429a60cd4cf760dd9852bb594b4be Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 17 Apr 2021 11:25:23 +0100 Subject: x1000: disable CPU idle stats by default There's no point including this in normal builds: the stats are not used for anything, they are not really of interest to anyone except developers, and add a small overhead to the kernel tick. Change-Id: I1b4f67cc62d11d634a8cec279dca513dd10eea96 --- firmware/target/mips/ingenic_x1000/system-target.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'firmware/target/mips/ingenic_x1000/system-target.h') diff --git a/firmware/target/mips/ingenic_x1000/system-target.h b/firmware/target/mips/ingenic_x1000/system-target.h index 050afcca9e..45a1eab1ff 100644 --- a/firmware/target/mips/ingenic_x1000/system-target.h +++ b/firmware/target/mips/ingenic_x1000/system-target.h @@ -37,6 +37,11 @@ # define MIPS_CACHEFUNC_ATTR #endif +#ifdef DEBUG +/* Define this to get CPU idle stats, visible in the debug menu. */ +# define X1000_CPUIDLE_STATS +#endif + #include "mmu-mips.h" #include "mipsregs.h" #include "mipsr2-endian.h" @@ -66,16 +71,20 @@ static inline int set_irq_level(int lev) return oldreg; } +#ifdef X1000_CPUIDLE_STATS /* CPU idle stats, updated each kernel tick in kernel-x1000.c */ extern int __cpu_idle_avg; extern int __cpu_idle_cur; extern uint32_t __cpu_idle_ticks; extern uint32_t __cpu_idle_reftick; +#endif static inline uint32_t __ost_read32(void); static inline void core_sleep(void) { +#ifdef X1000_CPUIDLE_STATS uint32_t t1 = __ost_read32(); +#endif __asm__ __volatile__( ".set push\n\t" @@ -90,8 +99,10 @@ static inline void core_sleep(void) ".set pop\n\t" ::: "t0", "t1", "t2"); +#ifdef X1000_CPUIDLE_STATS uint32_t t2 = __ost_read32(); __cpu_idle_ticks += t2 - t1; +#endif enable_irq(); } -- cgit v1.2.3