From 95b10ac74e7a996b9b1ce7ce88c205e39b67502b Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 28 Sep 2021 23:42:33 -0400 Subject: 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 --- firmware/kernel/thread.c | 7 +++++++ firmware/system.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'firmware') diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c index 307be7116a..a422624df7 100644 --- a/firmware/kernel/thread.c +++ b/firmware/kernel/thread.c @@ -1501,7 +1501,14 @@ static inline void boost_thread(struct thread_entry *thread, bool boost) if ((thread->cpu_boost != 0) != 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); +#endif } } diff --git a/firmware/system.c b/firmware/system.c index 537e901b05..e2fdff0e59 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -89,6 +89,7 @@ char * cpu_boost_log_getlog_next(void) void cpu_boost_(bool on_off, char* location, int line) { + int item = cpu_boost_calls_count; if (!cpu_boost_lock()) return; @@ -98,12 +99,13 @@ void cpu_boost_(bool on_off, char* location, int line) cpu_boost_calls_count--; if (cpu_boost_calls_count < 0) cpu_boost_calls_count = 0; + item += cpu_boost_first; } 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?'B':'U',location,line); + snprintf(cpu_boost_calls[message], MAX_PATH,"%d.) %c %d %s:%d", + item,on_off?'B':'U',boost_counter,location,line); cpu_boost_calls_count++; } #else -- cgit v1.2.3