forked from len0rd/rockbox
Simple cpu boost tracker for LOGF builds. Shows the last 64 cpu_boost() calls from the debug menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12087 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a3a303e440
commit
f8c68c7912
7 changed files with 133 additions and 3 deletions
|
|
@ -39,9 +39,55 @@ int get_cpu_boost_counter(void)
|
|||
{
|
||||
return boost_counter;
|
||||
}
|
||||
|
||||
#ifdef CPU_BOOST_LOGGING
|
||||
#define MAX_BOOST_LOG 64
|
||||
static char cpu_boost_calls[MAX_BOOST_LOG][MAX_PATH];
|
||||
static int cpu_boost_first = 0;
|
||||
static int cpu_boost_calls_count = 0;
|
||||
static int cpu_boost_track_message = 0;
|
||||
int cpu_boost_log_getcount(void)
|
||||
{
|
||||
return cpu_boost_calls_count;
|
||||
}
|
||||
char * cpu_boost_log_getlog_first(void)
|
||||
{
|
||||
if (cpu_boost_calls_count)
|
||||
{
|
||||
cpu_boost_track_message = 1;
|
||||
return cpu_boost_calls[cpu_boost_first];
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
char * cpu_boost_log_getlog_next(void)
|
||||
{
|
||||
int message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG;
|
||||
if (cpu_boost_track_message < cpu_boost_calls_count)
|
||||
{
|
||||
cpu_boost_track_message++;
|
||||
return cpu_boost_calls[message];
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
void cpu_boost_(bool on_off, char* location, int line)
|
||||
{
|
||||
if (cpu_boost_calls_count == MAX_BOOST_LOG)
|
||||
{
|
||||
cpu_boost_first = (cpu_boost_first+1)%MAX_BOOST_LOG;
|
||||
cpu_boost_calls_count--;
|
||||
if (cpu_boost_calls_count < 0)
|
||||
cpu_boost_calls_count = 0;
|
||||
}
|
||||
if (cpu_boost_calls_count < MAX_BOOST_LOG)
|
||||
{
|
||||
int message = (cpu_boost_first+cpu_boost_calls_count)%MAX_BOOST_LOG;
|
||||
snprintf(cpu_boost_calls[message], MAX_PATH,
|
||||
"%c %s:%d",on_off==true?'B':'U',location,line);
|
||||
cpu_boost_calls_count++;
|
||||
}
|
||||
#else
|
||||
void cpu_boost(bool on_off)
|
||||
{
|
||||
#endif
|
||||
if(on_off)
|
||||
{
|
||||
/* Boost the frequency if not already boosted */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue