forked from len0rd/rockbox
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
This commit is contained in:
parent
01d1eb4258
commit
fceffb7d4a
4 changed files with 19 additions and 0 deletions
|
@ -130,6 +130,7 @@ static bool dbg_audio(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
static bool dbg_cpuidle(void)
|
static bool dbg_cpuidle(void)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
|
@ -143,6 +144,7 @@ static bool dbg_cpuidle(void)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FIIO_M3K
|
#ifdef FIIO_M3K
|
||||||
extern bool dbg_fiiom3k_touchpad(void);
|
extern bool dbg_fiiom3k_touchpad(void);
|
||||||
|
@ -156,7 +158,9 @@ static const struct {
|
||||||
} menuitems[] = {
|
} menuitems[] = {
|
||||||
{"Clocks", &dbg_clocks},
|
{"Clocks", &dbg_clocks},
|
||||||
{"GPIOs", &dbg_gpios},
|
{"GPIOs", &dbg_gpios},
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
{"CPU idle", &dbg_cpuidle},
|
{"CPU idle", &dbg_cpuidle},
|
||||||
|
#endif
|
||||||
{"Audio", &dbg_audio},
|
{"Audio", &dbg_audio},
|
||||||
#ifdef FIIO_M3K
|
#ifdef FIIO_M3K
|
||||||
{"Touchpad", &dbg_fiiom3k_touchpad},
|
{"Touchpad", &dbg_fiiom3k_touchpad},
|
||||||
|
|
|
@ -57,6 +57,7 @@ void tick_start(unsigned interval_in_ms)
|
||||||
|
|
||||||
void OST(void)
|
void OST(void)
|
||||||
{
|
{
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
/* CPU idle time accounting */
|
/* CPU idle time accounting */
|
||||||
uint32_t now = __ost_read32();
|
uint32_t now = __ost_read32();
|
||||||
uint32_t div = now - __cpu_idle_reftick;
|
uint32_t div = now - __cpu_idle_reftick;
|
||||||
|
@ -67,6 +68,7 @@ void OST(void)
|
||||||
__cpu_idle_ticks = 0;
|
__cpu_idle_ticks = 0;
|
||||||
__cpu_idle_reftick = now;
|
__cpu_idle_reftick = now;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Call regular kernel tick */
|
/* Call regular kernel tick */
|
||||||
jz_write(OST_1FLG, 0);
|
jz_write(OST_1FLG, 0);
|
||||||
|
|
|
@ -37,6 +37,11 @@
|
||||||
# define MIPS_CACHEFUNC_ATTR
|
# define MIPS_CACHEFUNC_ATTR
|
||||||
#endif
|
#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 "mmu-mips.h"
|
||||||
#include "mipsregs.h"
|
#include "mipsregs.h"
|
||||||
#include "mipsr2-endian.h"
|
#include "mipsr2-endian.h"
|
||||||
|
@ -66,16 +71,20 @@ static inline int set_irq_level(int lev)
|
||||||
return oldreg;
|
return oldreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
/* CPU idle stats, updated each kernel tick in kernel-x1000.c */
|
/* CPU idle stats, updated each kernel tick in kernel-x1000.c */
|
||||||
extern int __cpu_idle_avg;
|
extern int __cpu_idle_avg;
|
||||||
extern int __cpu_idle_cur;
|
extern int __cpu_idle_cur;
|
||||||
extern uint32_t __cpu_idle_ticks;
|
extern uint32_t __cpu_idle_ticks;
|
||||||
extern uint32_t __cpu_idle_reftick;
|
extern uint32_t __cpu_idle_reftick;
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline uint32_t __ost_read32(void);
|
static inline uint32_t __ost_read32(void);
|
||||||
static inline void core_sleep(void)
|
static inline void core_sleep(void)
|
||||||
{
|
{
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
uint32_t t1 = __ost_read32();
|
uint32_t t1 = __ost_read32();
|
||||||
|
#endif
|
||||||
|
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
".set push\n\t"
|
".set push\n\t"
|
||||||
|
@ -90,8 +99,10 @@ static inline void core_sleep(void)
|
||||||
".set pop\n\t"
|
".set pop\n\t"
|
||||||
::: "t0", "t1", "t2");
|
::: "t0", "t1", "t2");
|
||||||
|
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
uint32_t t2 = __ost_read32();
|
uint32_t t2 = __ost_read32();
|
||||||
__cpu_idle_ticks += t2 - t1;
|
__cpu_idle_ticks += t2 - t1;
|
||||||
|
#endif
|
||||||
|
|
||||||
enable_irq();
|
enable_irq();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,12 @@
|
||||||
#include "x1000/msc.h"
|
#include "x1000/msc.h"
|
||||||
#include "x1000/aic.h"
|
#include "x1000/aic.h"
|
||||||
|
|
||||||
|
#ifdef X1000_CPUIDLE_STATS
|
||||||
int __cpu_idle_avg = 0;
|
int __cpu_idle_avg = 0;
|
||||||
int __cpu_idle_cur = 0;
|
int __cpu_idle_cur = 0;
|
||||||
uint32_t __cpu_idle_ticks = 0;
|
uint32_t __cpu_idle_ticks = 0;
|
||||||
uint32_t __cpu_idle_reftick = 0;
|
uint32_t __cpu_idle_reftick = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Prepare the CPU to process interrupts, but don't enable them yet */
|
/* Prepare the CPU to process interrupts, but don't enable them yet */
|
||||||
static void system_init_irq(void)
|
static void system_init_irq(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue