Removed the cpu boost tracking debug feature for now because of
different kind of problems. Better implementation can be done later. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11665 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5f15f8f021
commit
c5d57f0aae
9 changed files with 33 additions and 99 deletions
|
@ -1280,11 +1280,7 @@ bool dbg_cpufreq(void)
|
|||
snprintf(buf, sizeof(buf), "Frequency: %ld", FREQ);
|
||||
lcd_puts(0, line++, buf);
|
||||
|
||||
#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();
|
||||
|
@ -1293,16 +1289,16 @@ bool dbg_cpufreq(void)
|
|||
switch(button)
|
||||
{
|
||||
case ACTION_STD_PREV:
|
||||
cpu_boost_id(true, CPUBOOSTID_DEBUGMENU_MANUAL);
|
||||
cpu_boost(true);
|
||||
break;
|
||||
|
||||
case ACTION_STD_NEXT:
|
||||
cpu_boost_id(false, CPUBOOSTID_DEBUGMENU_MANUAL);
|
||||
cpu_boost(false);
|
||||
break;
|
||||
|
||||
case ACTION_STD_OK:
|
||||
while (get_cpu_boost_counter() > 0)
|
||||
cpu_boost_id(false, CPUBOOSTID_DEBUGMENU_MANUAL);
|
||||
cpu_boost(false);
|
||||
set_cpu_frequency(CPUFREQ_DEFAULT);
|
||||
break;
|
||||
|
||||
|
|
|
@ -2872,14 +2872,14 @@ int playlist_insert_directory(struct playlist_info* playlist,
|
|||
context.queue = queue;
|
||||
context.count = 0;
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_PLAYLIST);
|
||||
cpu_boost(true);
|
||||
|
||||
result = playlist_directory_tracksearch(dirname, recurse,
|
||||
directory_search_callback, &context);
|
||||
|
||||
sync_control(playlist, false);
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_PLAYLIST);
|
||||
cpu_boost(false);
|
||||
|
||||
display_playlist_count(context.count, count_str);
|
||||
|
||||
|
@ -2941,7 +2941,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
|
|||
|
||||
display_playlist_count(count, count_str);
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_PLAYLIST);
|
||||
cpu_boost(true);
|
||||
|
||||
while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0)
|
||||
{
|
||||
|
@ -3000,7 +3000,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
|
|||
|
||||
sync_control(playlist, false);
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_PLAYLIST);
|
||||
cpu_boost(false);
|
||||
|
||||
display_playlist_count(count, count_str);
|
||||
|
||||
|
@ -3347,7 +3347,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
|
|||
|
||||
display_playlist_count(count, str(LANG_PLAYLIST_SAVE_COUNT));
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_PLAYLIST);
|
||||
cpu_boost(true);
|
||||
|
||||
index = playlist->first_index;
|
||||
for (i=0; i<playlist->amount; i++)
|
||||
|
@ -3440,7 +3440,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
|
|||
|
||||
}
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_PLAYLIST);
|
||||
cpu_boost(false);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -3534,7 +3534,7 @@ void build_tagcache(const char *path)
|
|||
|
||||
filenametag_fd = open_tag_fd(&header, tag_filename, false);
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(true);
|
||||
|
||||
logf("Scanning files...");
|
||||
/* Scan for new files. */
|
||||
|
@ -3562,7 +3562,7 @@ void build_tagcache(const char *path)
|
|||
if (!ret)
|
||||
{
|
||||
logf("Aborted.");
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(false);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -3588,7 +3588,7 @@ void build_tagcache(const char *path)
|
|||
}
|
||||
#endif
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TC_RAMCACHE
|
||||
|
@ -3597,7 +3597,7 @@ static void load_ramcache(void)
|
|||
if (!hdr)
|
||||
return ;
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(true);
|
||||
|
||||
/* At first we should load the cache (if exists). */
|
||||
tc_stat.ramcache = load_tagcache();
|
||||
|
@ -3610,7 +3610,7 @@ static void load_ramcache(void)
|
|||
hdr = NULL;
|
||||
}
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(false);
|
||||
}
|
||||
|
||||
void tagcache_unload_ramcache(void)
|
||||
|
@ -3656,7 +3656,7 @@ static void tagcache_thread(void)
|
|||
|
||||
/* If the previous cache build/update was interrupted, commit
|
||||
* the changes first in foreground. */
|
||||
cpu_boost_id(true, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(true);
|
||||
allocate_tempbuf();
|
||||
commit();
|
||||
free_tempbuf();
|
||||
|
@ -3674,7 +3674,7 @@ static void tagcache_thread(void)
|
|||
allocate_tagcache();
|
||||
#endif
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGCACHE);
|
||||
cpu_boost(false);
|
||||
tc_stat.initialized = true;
|
||||
|
||||
/* Don't delay bootup with the header check but do it on background. */
|
||||
|
|
|
@ -1284,9 +1284,9 @@ int tagtree_load(struct tree_context* c)
|
|||
case allsubentries:
|
||||
case navibrowse:
|
||||
logf("navibrowse...");
|
||||
cpu_boost_id(true, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(true);
|
||||
count = retrieve_entries(c, &tcs, 0, true);
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1460,11 +1460,11 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue)
|
|||
int from, to, direction;
|
||||
int files_left = c->filesindir;
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(true);
|
||||
if (!tagcache_search(&tcs, tag_filename))
|
||||
{
|
||||
gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY));
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1502,7 +1502,7 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue)
|
|||
}
|
||||
playlist_sync(NULL);
|
||||
tagcache_search_finish(&tcs);
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1606,16 +1606,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_id(true, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(true);
|
||||
if (retrieve_entries(c, &tcs2, MAX(0, id - (current_entry_count / 2)),
|
||||
false) < 0)
|
||||
{
|
||||
logf("retrieve failed");
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(false);
|
||||
return NULL;
|
||||
}
|
||||
realid = id - current_offset;
|
||||
cpu_boost_id(false, CPUBOOSTID_TAGTREE);
|
||||
cpu_boost(false);
|
||||
}
|
||||
|
||||
return &entry[realid];
|
||||
|
|
|
@ -219,7 +219,7 @@ static void load_voicefile(void)
|
|||
/* Do a bitswap as necessary. */
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
logf("Bitswapping voice file.");
|
||||
cpu_boost_id(true, CPUBOOSTID_TALK);
|
||||
cpu_boost(true);
|
||||
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);
|
||||
|
@ -231,7 +231,7 @@ static void load_voicefile(void)
|
|||
temp = ((temp >> 2) & 0x33) | ((temp & 0x33) << 2);
|
||||
buf[i] = ((temp >> 1) & 0x55) | ((temp & 0x55) << 1);
|
||||
}
|
||||
cpu_boost_id(false, CPUBOOSTID_TALK);
|
||||
cpu_boost(false);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -549,16 +549,16 @@ static int dircache_do_rebuild(void)
|
|||
memset(dircache_cur_path, 0, sizeof(dircache_cur_path));
|
||||
dircache_size = sizeof(struct dircache_entry);
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_DIRCACHE);
|
||||
cpu_boost(true);
|
||||
if (dircache_travel(pdir, dircache_root) < 0)
|
||||
{
|
||||
logf("dircache_travel failed");
|
||||
cpu_boost_id(false, CPUBOOSTID_DIRCACHE);
|
||||
cpu_boost(false);
|
||||
dircache_size = 0;
|
||||
dircache_initializing = false;
|
||||
return -2;
|
||||
}
|
||||
cpu_boost_id(false, CPUBOOSTID_DIRCACHE);
|
||||
cpu_boost(false);
|
||||
|
||||
logf("Done, %d KiB used", dircache_size / 1024);
|
||||
|
||||
|
|
|
@ -60,32 +60,6 @@ void set_cpu_frequency(long frequency);
|
|||
void cpu_boost(bool on_off);
|
||||
void cpu_idle_mode(bool on_off);
|
||||
int get_cpu_boost_counter(void);
|
||||
|
||||
#if MEM > 1
|
||||
#define CPU_BOOST_TRACKING
|
||||
#endif
|
||||
|
||||
#ifdef CPU_BOOST_TRACKING
|
||||
void cpu_boost_id(bool on_off, char id);
|
||||
const char *get_cpu_boost_tracker(void);
|
||||
/* CPU boost ID chars, in alphabetical order */
|
||||
#define CPUBOOSTID_PLAYBACK_AUDIO 'A'
|
||||
#define CPUBOOSTID_TAGTREE 'a'
|
||||
#define CPUBOOSTID_BACKLIGHT 'b'
|
||||
#define CPUBOOSTID_PLAYBACK_CODEC 'c'
|
||||
#define CPUBOOSTID_DIRCACHE 'd'
|
||||
#define CPUBOOSTID_MAININIT 'i'
|
||||
#define CPUBOOSTID_DEBUGMENU_MANUAL 'm'
|
||||
#define CPUBOOSTID_PLAYLIST 'P'
|
||||
#define CPUBOOSTID_PCMBUF 'p'
|
||||
#define CPUBOOSTID_PCMRECORD 'R'
|
||||
#define CPUBOOSTID_TREE 'r'
|
||||
#define CPUBOOSTID_TALK 'T'
|
||||
#define CPUBOOSTID_TAGCACHE 't'
|
||||
#define CPUBOOSTID_PLAYBACK_VOICE 'v'
|
||||
#else
|
||||
#define cpu_boost_id(on_off,id) cpu_boost(on_off)
|
||||
#endif
|
||||
#else
|
||||
#define FREQ CPU_FREQ
|
||||
#define set_cpu_frequency(frequency)
|
||||
|
|
|
@ -796,7 +796,7 @@ static void pcmrec_flush(unsigned flush_num)
|
|||
|
||||
logf("writing: %d (%d)", num_ready, flush_num);
|
||||
|
||||
cpu_boost_id(true, CPUBOOSTID_PCMRECORD);
|
||||
cpu_boost(true);
|
||||
|
||||
for (i=0; i<num_ready; i++)
|
||||
{
|
||||
|
@ -844,7 +844,7 @@ static void pcmrec_flush(unsigned flush_num)
|
|||
if (rec_fdata.rec_file >= 0)
|
||||
fsync(rec_fdata.rec_file);
|
||||
|
||||
cpu_boost_id(false, CPUBOOSTID_PCMRECORD);
|
||||
cpu_boost(false);
|
||||
|
||||
if (prio != -1)
|
||||
{
|
||||
|
|
|
@ -34,37 +34,19 @@ long cpu_frequency = CPU_FREQ;
|
|||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
static int boost_counter = 0;
|
||||
static bool cpu_idle = false;
|
||||
#ifdef CPU_BOOST_TRACKING
|
||||
#define CPU_BOOST_TRACKER_MAX 15
|
||||
static char cpu_boost_tracker[CPU_BOOST_TRACKER_MAX+1] = "";
|
||||
#endif
|
||||
|
||||
int get_cpu_boost_counter(void)
|
||||
{
|
||||
return boost_counter;
|
||||
}
|
||||
|
||||
#ifdef CPU_BOOST_TRACKING
|
||||
const char *get_cpu_boost_tracker()
|
||||
{
|
||||
return cpu_boost_tracker;
|
||||
}
|
||||
|
||||
void cpu_boost_id(bool on_off, char id)
|
||||
void cpu_boost(bool on_off)
|
||||
{
|
||||
if(on_off)
|
||||
{
|
||||
/* Boost the frequency if not already boosted */
|
||||
if(boost_counter++ == 0)
|
||||
set_cpu_frequency(CPUFREQ_MAX);
|
||||
|
||||
/* Add to the boost tracker for debugging */
|
||||
int l = strlen(cpu_boost_tracker);
|
||||
if (l < CPU_BOOST_TRACKER_MAX)
|
||||
{
|
||||
cpu_boost_tracker[l] = id;
|
||||
cpu_boost_tracker[l+1] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -80,26 +62,8 @@ void cpu_boost_id(bool on_off, char id)
|
|||
/* Safety measure */
|
||||
if(boost_counter < 0)
|
||||
boost_counter = 0;
|
||||
|
||||
/* Remove an entry from the boost tracker */
|
||||
int l = strlen(cpu_boost_tracker);
|
||||
while (l >= 0 && cpu_boost_tracker[l] != id)
|
||||
l--;
|
||||
if (cpu_boost_tracker[l] != id) /* No match found? */
|
||||
l = strlen(cpu_boost_tracker)-1; /* Just remove last one */
|
||||
while (l < CPU_BOOST_TRACKER_MAX)
|
||||
{
|
||||
cpu_boost_tracker[l] = cpu_boost_tracker[l+1];
|
||||
l++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void cpu_boost(bool on_off)
|
||||
{
|
||||
cpu_boost_id(on_off, '?');
|
||||
}
|
||||
|
||||
void cpu_idle_mode(bool on_off)
|
||||
{
|
||||
|
@ -115,8 +79,8 @@ void cpu_idle_mode(bool on_off)
|
|||
set_cpu_frequency(CPUFREQ_NORMAL);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
||||
|
||||
#endif
|
||||
#if CONFIG_CPU == S3C2440
|
||||
|
||||
void system_reboot(void) {
|
||||
|
|
Loading…
Reference in a new issue