Add ability to dump cpu boost log to disk, include thread names
0.) B 0 /rockbox/apps/main.c:405 1.) B 1 /rockbox/firmware/kernel/thread.c thread[dircache]:1508 2.) B 2 /rockbox/apps/tagcache.c:4772 3.) U 3 /rockbox/apps/tagcache.c:4793 add logic to show count after log rolls over clean-up Change-Id: Ibda0a56e5d8d89aa8b7649f4f9fa64eb1ff0e08f
This commit is contained in:
parent
5883cb4a52
commit
95b10ac74e
|
@ -2242,6 +2242,51 @@ static bool cpu_boost_log(void)
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool cpu_boost_log_dump(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
#if CONFIG_RTC
|
||||||
|
struct tm *nowtm;
|
||||||
|
char fname[MAX_PATH];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int count = cpu_boost_log_getcount();
|
||||||
|
char *str = cpu_boost_log_getlog_first();
|
||||||
|
|
||||||
|
splashf(HZ, "Boost Log File Dumped");
|
||||||
|
|
||||||
|
/* nothing to print ? */
|
||||||
|
if(count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if CONFIG_RTC
|
||||||
|
nowtm = get_time();
|
||||||
|
snprintf(fname, MAX_PATH, "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR,
|
||||||
|
nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday,
|
||||||
|
nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec);
|
||||||
|
fd = open(fname, O_CREAT|O_WRONLY|O_TRUNC);
|
||||||
|
#else
|
||||||
|
fd = open(ROCKBOX_DIR "/boostlog.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
||||||
|
#endif
|
||||||
|
if(-1 != fd) {
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (!str)
|
||||||
|
str = cpu_boost_log_getlog_next();
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
fdprintf(fd, "%s\n", str);
|
||||||
|
str = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
|
#if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
|
||||||
|
@ -2604,7 +2649,8 @@ static const struct {
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_USBSTACK */
|
#endif /* HAVE_USBSTACK */
|
||||||
#ifdef CPU_BOOST_LOGGING
|
#ifdef CPU_BOOST_LOGGING
|
||||||
{"cpu_boost log",cpu_boost_log},
|
{"Show cpu_boost log",cpu_boost_log},
|
||||||
|
{"Dump cpu_boost log",cpu_boost_log_dump},
|
||||||
#endif
|
#endif
|
||||||
#if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
|
#if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
|
||||||
&& !defined(IPOD_MINI) && !defined(SIMULATOR))
|
&& !defined(IPOD_MINI) && !defined(SIMULATOR))
|
||||||
|
|
|
@ -1501,7 +1501,14 @@ static inline void boost_thread(struct thread_entry *thread, bool boost)
|
||||||
if ((thread->cpu_boost != 0) != boost)
|
if ((thread->cpu_boost != 0) != boost)
|
||||||
{
|
{
|
||||||
thread->cpu_boost = boost;
|
thread->cpu_boost = boost;
|
||||||
|
#ifdef CPU_BOOST_LOGGING
|
||||||
|
const char fmt[] = __FILE__" thread[%s]";
|
||||||
|
char pathbuf[sizeof(fmt) + 32]; /* thread name 32 */
|
||||||
|
snprintf(pathbuf, sizeof(pathbuf), fmt, thread->name);
|
||||||
|
cpu_boost_(boost, pathbuf, __LINE__);
|
||||||
|
#else
|
||||||
cpu_boost(boost);
|
cpu_boost(boost);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ char * cpu_boost_log_getlog_next(void)
|
||||||
|
|
||||||
void cpu_boost_(bool on_off, char* location, int line)
|
void cpu_boost_(bool on_off, char* location, int line)
|
||||||
{
|
{
|
||||||
|
int item = cpu_boost_calls_count;
|
||||||
if (!cpu_boost_lock())
|
if (!cpu_boost_lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -98,12 +99,13 @@ void cpu_boost_(bool on_off, char* location, int line)
|
||||||
cpu_boost_calls_count--;
|
cpu_boost_calls_count--;
|
||||||
if (cpu_boost_calls_count < 0)
|
if (cpu_boost_calls_count < 0)
|
||||||
cpu_boost_calls_count = 0;
|
cpu_boost_calls_count = 0;
|
||||||
|
item += cpu_boost_first;
|
||||||
}
|
}
|
||||||
if (cpu_boost_calls_count < MAX_BOOST_LOG)
|
if (cpu_boost_calls_count < MAX_BOOST_LOG)
|
||||||
{
|
{
|
||||||
int message = (cpu_boost_first+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,
|
snprintf(cpu_boost_calls[message], MAX_PATH,"%d.) %c %d %s:%d",
|
||||||
"%c %s:%d",on_off?'B':'U',location,line);
|
item,on_off?'B':'U',boost_counter,location,line);
|
||||||
cpu_boost_calls_count++;
|
cpu_boost_calls_count++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue