From d49c810ec9c6010bf41e0ef7ebad101a79373438 Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Thu, 5 Oct 2006 10:07:03 +0000 Subject: Add CPU boost tracker to see where boosts are coming from git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11125 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 16 ++++++++++------ apps/main.c | 4 ++-- apps/pcmbuf.c | 2 +- apps/playback.c | 10 +++++----- apps/playlist.c | 12 ++++++------ apps/tagcache.c | 14 +++++++------- apps/tagtree.c | 16 ++++++++-------- apps/talk.c | 4 ++-- apps/tree.c | 8 ++------ 9 files changed, 43 insertions(+), 43 deletions(-) (limited to 'apps') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 70fc3ac46e..fa650739f5 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1258,7 +1258,6 @@ bool dbg_ports(void) #endif /* !SIMULATOR */ #ifdef HAVE_ADJUSTABLE_CPU_FREQ -extern int boost_counter; bool dbg_cpufreq(void) { char buf[128]; @@ -1278,7 +1277,11 @@ bool dbg_cpufreq(void) snprintf(buf, sizeof(buf), "Frequency: %ld", FREQ); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "boost_counter: %d", boost_counter); +#ifdef CPU_BOOST_TRACKING + snprintf(buf, sizeof(buf), "boost_counter: %d %s", get_cpu_boost_counter(), get_cpu_boost_tracker()); +#else + snprintf(buf, sizeof(buf), "boost_counter: %d", get_cpu_boost_counter()); +#endif lcd_puts(0, line++, buf); lcd_update(); @@ -1287,15 +1290,16 @@ bool dbg_cpufreq(void) switch(button) { case ACTION_STD_PREV: - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_DEBUGMENU_MANUAL); break; + case ACTION_STD_NEXT: - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_DEBUGMENU_MANUAL); break; case ACTION_STD_OK: - set_cpu_frequency(CPUFREQ_DEFAULT); - boost_counter = 0; + while (get_cpu_boost_counter() > 0) + cpu_boost_id(false, CPUBOOSTID_DEBUGMENU_MANUAL); break; case ACTION_STD_CANCEL: diff --git a/apps/main.c b/apps/main.c index a2bbe73e65..bd1dd7b03c 100644 --- a/apps/main.c +++ b/apps/main.c @@ -276,7 +276,7 @@ void init(void) #ifdef HAVE_ADJUSTABLE_CPU_FREQ set_cpu_frequency(CPUFREQ_NORMAL); - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_MAININIT); #endif buffer_init(); @@ -482,7 +482,7 @@ void init(void) #endif /* runtime database has to be initialized after audio_init() */ - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_MAININIT); #ifdef AUTOROCK { diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index b4d9bcec4e..6d2f68a238 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -121,7 +121,7 @@ void pcmbuf_boost(bool state) if (state != boost_state) { - cpu_boost(state); + cpu_boost_id(state, CPUBOOSTID_PCMBUF); boost_state = state; } diff --git a/apps/playback.c b/apps/playback.c index 76f0788583..cb4900e1ae 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -822,7 +822,7 @@ static void voice_boost_cpu(bool state) if (state != voice_cpu_boosted) { voice_cpu_boosted = state; - cpu_boost(state); + cpu_boost_id(state, CPUBOOSTID_PLAYBACK_VOICE); } } #endif @@ -1676,7 +1676,7 @@ static bool codec_load_next_track(void) automatic_skip = true; } - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_PLAYBACK_CODEC); LOGFQUEUE("codec > audio Q_AUDIO_CHECK_NEW_TRACK"); queue_post(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0); while (1) @@ -1690,7 +1690,7 @@ static bool codec_load_next_track(void) else break; } - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_PLAYBACK_CODEC); switch (ev.id) { case Q_CODEC_REQUEST_COMPLETE: @@ -2177,7 +2177,7 @@ static void audio_read_file(bool quick) return ; } - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_PLAYBACK_AUDIO); while (tracks[track_widx].filerem > 0) { int overlap; @@ -2245,7 +2245,7 @@ static void audio_read_file(bool quick) logf("Partially buf:%dB", tracks[track_widx].filesize - tracks[track_widx].filerem); } - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_PLAYBACK_AUDIO); } static bool audio_loadcodec(bool start_play) diff --git a/apps/playlist.c b/apps/playlist.c index 6648d4462e..9d844e3b84 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -2812,14 +2812,14 @@ int playlist_insert_directory(struct playlist_info* playlist, context.queue = queue; context.count = 0; - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_PLAYLIST); result = playlist_directory_tracksearch(dirname, recurse, directory_search_callback, &context); sync_control(playlist, false); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_PLAYLIST); display_playlist_count(context.count, count_str); @@ -2881,7 +2881,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename, display_playlist_count(count, count_str); - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_PLAYLIST); while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0) { @@ -2940,7 +2940,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename, sync_control(playlist, false); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_PLAYLIST); display_playlist_count(count, count_str); @@ -3287,7 +3287,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) display_playlist_count(count, str(LANG_PLAYLIST_SAVE_COUNT)); - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_PLAYLIST); index = playlist->first_index; for (i=0; iamount; i++) @@ -3380,7 +3380,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) } - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_PLAYLIST); return result; } diff --git a/apps/tagcache.c b/apps/tagcache.c index 70934b4f36..1c180b7f43 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -3459,7 +3459,7 @@ static void build_tagcache(void) filenametag_fd = open_tag_fd(&header, tag_filename, false); - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TAGCACHE); /* Scan for new files. */ memset(&header, 0, sizeof(struct tagcache_header)); @@ -3485,7 +3485,7 @@ static void build_tagcache(void) if (!ret) { logf("Aborted."); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGCACHE); return ; } @@ -3505,7 +3505,7 @@ static void build_tagcache(void) } #endif - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGCACHE); } #ifdef HAVE_TC_RAMCACHE @@ -3514,7 +3514,7 @@ static void load_ramcache(void) if (!hdr) return ; - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TAGCACHE); /* At first we should load the cache (if exists). */ stat.ramcache = load_tagcache(); @@ -3527,7 +3527,7 @@ static void load_ramcache(void) hdr = NULL; } - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGCACHE); } void tagcache_unload_ramcache(void) @@ -3572,7 +3572,7 @@ static void tagcache_thread(void) /* If the previous cache build/update was interrupted, commit * the changes first in foreground. */ - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TAGCACHE); allocate_tempbuf(); commit(); free_tempbuf(); @@ -3590,7 +3590,7 @@ static void tagcache_thread(void) allocate_tagcache(); #endif - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGCACHE); stat.initialized = true; /* Don't delay bootup with the header check but do it on background. */ diff --git a/apps/tagtree.c b/apps/tagtree.c index 377cc27ec0..f9542821d8 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -1121,9 +1121,9 @@ int tagtree_load(struct tree_context* c) case allsubentries: case navibrowse: logf("navibrowse..."); - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TAGTREE); count = retrieve_entries(c, &tcs, 0, true); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGTREE); break; default: @@ -1297,11 +1297,11 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue) char buf[MAX_PATH]; int from, to, direction; - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TAGTREE); if (!tagcache_search(&tcs, tag_filename)) { gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY)); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGTREE); return false; } @@ -1338,7 +1338,7 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue) } playlist_sync(NULL); tagcache_search_finish(&tcs); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGTREE); return true; } @@ -1442,16 +1442,16 @@ struct tagentry* tagtree_get_entry(struct tree_context *c, int id) /* Load the next chunk if necessary. */ if (realid >= current_entry_count || realid < 0) { - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TAGTREE); if (retrieve_entries(c, &tcs2, MAX(0, id - (current_entry_count / 2)), false) < 0) { logf("retrieve failed"); - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGTREE); return NULL; } realid = id - current_offset; - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TAGTREE); } return &entry[realid]; diff --git a/apps/talk.c b/apps/talk.c index a92425d439..d03fead233 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -215,7 +215,7 @@ static void load_voicefile(void) /* Do a bitswap as necessary. */ #if CONFIG_CODEC == SWCODEC logf("Bitswapping voice file."); - cpu_boost(true); + cpu_boost_id(true, CPUBOOSTID_TALK); buf = (unsigned char *)(&p_voicefile->index) + (p_voicefile->id1_max + p_voicefile->id2_max) * sizeof(struct clip_entry); length = file_size - (buf - (unsigned char *) p_voicefile); @@ -227,7 +227,7 @@ static void load_voicefile(void) temp = ((temp >> 2) & 0x33) | ((temp & 0x33) << 2); buf[i] = ((temp >> 1) & 0x55) | ((temp & 0x55) << 1); } - cpu_boost(false); + cpu_boost_id(false, CPUBOOSTID_TALK); #endif diff --git a/apps/tree.c b/apps/tree.c index b5673e681c..70b83f8934 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -1177,9 +1177,7 @@ bool create_playlist(void) if (fd < 0) return false; -#ifdef HAVE_ADJUSTABLE_CPU_FREQ - cpu_boost(true); -#endif + cpu_boost_id(true, CPUBOOSTID_TREE); snprintf(filename, sizeof(filename), "%s", tc.currdir[1] ? tc.currdir : "/"); @@ -1187,9 +1185,7 @@ bool create_playlist(void) add_dir(filename, sizeof(filename), fd); close(fd); -#ifdef HAVE_ADJUSTABLE_CPU_FREQ - cpu_boost(false); -#endif + cpu_boost_id(false, CPUBOOSTID_TREE); sleep(HZ); -- cgit v1.2.3