diff options
author | Steve Bavin <pondlife@pondlife.me> | 2006-10-05 10:07:03 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2006-10-05 10:07:03 +0000 |
commit | d49c810ec9c6010bf41e0ef7ebad101a79373438 (patch) | |
tree | 26755e1026276ed7f88071a7739497f93dd3ef6a /firmware | |
parent | 3eb9e70b6467becb2aa88cc8d24a82a7c288f1fd (diff) | |
download | rockbox-d49c810ec9c6010bf41e0ef7ebad101a79373438.tar.gz rockbox-d49c810ec9c6010bf41e0ef7ebad101a79373438.zip |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/backlight.c | 6 | ||||
-rw-r--r-- | firmware/common/dircache.c | 6 | ||||
-rw-r--r-- | firmware/export/system.h | 30 | ||||
-rw-r--r-- | firmware/pcm_record.c | 4 | ||||
-rw-r--r-- | firmware/system.c | 48 |
5 files changed, 82 insertions, 12 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index cbd15ee46b..5e1f5922cd 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -288,7 +288,7 @@ static void backlight_switch(void) | |||
288 | static void backlight_release_timer(void) | 288 | static void backlight_release_timer(void) |
289 | { | 289 | { |
290 | #ifdef CPU_COLDFIRE | 290 | #ifdef CPU_COLDFIRE |
291 | cpu_boost(false); | 291 | cpu_boost_id(false, CPUBOOSTID_BACKLIGHT); |
292 | #endif | 292 | #endif |
293 | timer_unregister(); | 293 | timer_unregister(); |
294 | bl_timer_active = false; | 294 | bl_timer_active = false; |
@@ -310,7 +310,7 @@ static void backlight_dim(int value) | |||
310 | { | 310 | { |
311 | #ifdef CPU_COLDFIRE | 311 | #ifdef CPU_COLDFIRE |
312 | /* Prevent cpu frequency changes while dimming. */ | 312 | /* Prevent cpu frequency changes while dimming. */ |
313 | cpu_boost(true); | 313 | cpu_boost_id(true, CPUBOOSTID_BACKLIGHT); |
314 | #endif | 314 | #endif |
315 | bl_timer_active = true; | 315 | bl_timer_active = true; |
316 | } | 316 | } |
@@ -547,7 +547,7 @@ void backlight_thread(void) | |||
547 | #if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \ | 547 | #if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \ |
548 | && !defined(SIMULATOR) | 548 | && !defined(SIMULATOR) |
549 | case BACKLIGHT_UNBOOST_CPU: | 549 | case BACKLIGHT_UNBOOST_CPU: |
550 | cpu_boost(false); | 550 | cpu_boost_id(false, CPUBOOSTID_BACKLIGHT); |
551 | break; | 551 | break; |
552 | #endif | 552 | #endif |
553 | 553 | ||
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 0bdd0657bd..7222a41221 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c | |||
@@ -546,16 +546,16 @@ static int dircache_do_rebuild(void) | |||
546 | memset(dircache_cur_path, 0, MAX_PATH); | 546 | memset(dircache_cur_path, 0, MAX_PATH); |
547 | dircache_size = sizeof(struct dircache_entry); | 547 | dircache_size = sizeof(struct dircache_entry); |
548 | 548 | ||
549 | cpu_boost(true); | 549 | cpu_boost_id(true, CPUBOOSTID_DIRCACHE); |
550 | if (dircache_travel(pdir, dircache_root) < 0) | 550 | if (dircache_travel(pdir, dircache_root) < 0) |
551 | { | 551 | { |
552 | logf("dircache_travel failed"); | 552 | logf("dircache_travel failed"); |
553 | cpu_boost(false); | 553 | cpu_boost_id(false, CPUBOOSTID_DIRCACHE); |
554 | dircache_size = 0; | 554 | dircache_size = 0; |
555 | dircache_initializing = false; | 555 | dircache_initializing = false; |
556 | return -2; | 556 | return -2; |
557 | } | 557 | } |
558 | cpu_boost(false); | 558 | cpu_boost_id(false, CPUBOOSTID_DIRCACHE); |
559 | 559 | ||
560 | logf("Done, %d KiB used", dircache_size / 1024); | 560 | logf("Done, %d KiB used", dircache_size / 1024); |
561 | 561 | ||
diff --git a/firmware/export/system.h b/firmware/export/system.h index d13b27c529..cc2d166c62 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -60,11 +60,41 @@ bool detect_flashed_rockbox(void); | |||
60 | void set_cpu_frequency(long frequency); | 60 | void set_cpu_frequency(long frequency); |
61 | void cpu_boost(bool on_off); | 61 | void cpu_boost(bool on_off); |
62 | void cpu_idle_mode(bool on_off); | 62 | void cpu_idle_mode(bool on_off); |
63 | int get_cpu_boost_counter(void); | ||
64 | |||
65 | #if MEM > 1 | ||
66 | #define CPU_BOOST_TRACKING | ||
67 | #endif | ||
68 | |||
69 | #ifdef CPU_BOOST_TRACKING | ||
70 | void cpu_boost_id(bool on_off, char id); | ||
71 | const char *get_cpu_boost_tracker(void); | ||
72 | /* CPU boost ID chars, in alphabetical order */ | ||
73 | #define CPUBOOSTID_PLAYBACK_AUDIO 'A' | ||
74 | #define CPUBOOSTID_TAGTREE 'a' | ||
75 | #define CPUBOOSTID_BACKLIGHT 'b' | ||
76 | #define CPUBOOSTID_PLAYBACK_CODEC 'c' | ||
77 | #define CPUBOOSTID_DIRCACHE 'd' | ||
78 | #define CPUBOOSTID_MAININIT 'i' | ||
79 | #define CPUBOOSTID_DEBUGMENU_MANUAL 'm' | ||
80 | #define CPUBOOSTID_PLAYLIST 'P' | ||
81 | #define CPUBOOSTID_PCMRECORD 'R' | ||
82 | #define CPUBOOSTID_TREE 'r' | ||
83 | #define CPUBOOSTID_TREE 'r' | ||
84 | #define CPUBOOSTID_TALK 'T' | ||
85 | #define CPUBOOSTID_TAGCACHE 't' | ||
86 | #define CPUBOOSTID_PLAYBACK_VOICE 'v' | ||
87 | #else | ||
88 | #define cpu_boost_id(on_off,id) cpu_boost(on_off) | ||
89 | #endif | ||
63 | #else | 90 | #else |
64 | #define FREQ CPU_FREQ | 91 | #define FREQ CPU_FREQ |
65 | #define set_cpu_frequency(frequency) | 92 | #define set_cpu_frequency(frequency) |
66 | #define cpu_boost(on_off) | 93 | #define cpu_boost(on_off) |
94 | #define cpu_boost_id(on_off, id) | ||
67 | #define cpu_idle_mode(on_off) | 95 | #define cpu_idle_mode(on_off) |
96 | #define get_cpu_boost_counter() | ||
97 | #define get_cpu_boost_tracker() | ||
68 | #endif | 98 | #endif |
69 | 99 | ||
70 | #define BAUDRATE 9600 | 100 | #define BAUDRATE 9600 |
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c index 544ecb378d..2785d4b1b1 100644 --- a/firmware/pcm_record.c +++ b/firmware/pcm_record.c | |||
@@ -541,7 +541,7 @@ static void pcmrec_callback(bool flush) | |||
541 | { | 541 | { |
542 | logf("writing: %d (%d)", num_ready, flush); | 542 | logf("writing: %d (%d)", num_ready, flush); |
543 | 543 | ||
544 | cpu_boost(true); | 544 | cpu_boost_id(true, CPUBOOSTID_PCMRECORD); |
545 | 545 | ||
546 | size_yield = 0; | 546 | size_yield = 0; |
547 | for (i=0; i<num_ready; i++) | 547 | for (i=0; i<num_ready; i++) |
@@ -581,7 +581,7 @@ static void pcmrec_callback(bool flush) | |||
581 | /* sync file */ | 581 | /* sync file */ |
582 | fsync(wav_file); | 582 | fsync(wav_file); |
583 | 583 | ||
584 | cpu_boost(false); | 584 | cpu_boost_id(false, CPUBOOSTID_PCMRECORD); |
585 | 585 | ||
586 | logf("done"); | 586 | logf("done"); |
587 | } | 587 | } |
diff --git a/firmware/system.c b/firmware/system.c index 81c5a36917..9699fe8559 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -32,16 +32,38 @@ long cpu_frequency = CPU_FREQ; | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 34 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
35 | int boost_counter = 0; | 35 | static int boost_counter = 0; |
36 | bool cpu_idle = false; | 36 | static bool cpu_idle = false; |
37 | void cpu_boost(bool on_off) | 37 | #ifdef CPU_BOOST_TRACKING |
38 | #define CPU_BOOST_TRACKER_MAX 15 | ||
39 | static char cpu_boost_tracker[CPU_BOOST_TRACKER_MAX+1] = ""; | ||
40 | #endif | ||
41 | |||
42 | int get_cpu_boost_counter(void) | ||
43 | { | ||
44 | return boost_counter; | ||
45 | } | ||
46 | |||
47 | #ifdef CPU_BOOST_TRACKING | ||
48 | const char *get_cpu_boost_tracker() | ||
49 | { | ||
50 | return cpu_boost_tracker; | ||
51 | } | ||
52 | |||
53 | void cpu_boost_id(bool on_off, char id) | ||
38 | { | 54 | { |
39 | if(on_off) | 55 | if(on_off) |
40 | { | 56 | { |
41 | /* Boost the frequency if not already boosted */ | 57 | /* Boost the frequency if not already boosted */ |
42 | if(boost_counter++ == 0) | 58 | if(boost_counter++ == 0) |
43 | { | ||
44 | set_cpu_frequency(CPUFREQ_MAX); | 59 | set_cpu_frequency(CPUFREQ_MAX); |
60 | |||
61 | /* Add to the boost tracker for debugging */ | ||
62 | int l = strlen(cpu_boost_tracker); | ||
63 | if (l < CPU_BOOST_TRACKER_MAX) | ||
64 | { | ||
65 | cpu_boost_tracker[l] = id; | ||
66 | cpu_boost_tracker[l+1] = '\0'; | ||
45 | } | 67 | } |
46 | } | 68 | } |
47 | else | 69 | else |
@@ -58,8 +80,26 @@ void cpu_boost(bool on_off) | |||
58 | /* Safety measure */ | 80 | /* Safety measure */ |
59 | if(boost_counter < 0) | 81 | if(boost_counter < 0) |
60 | boost_counter = 0; | 82 | boost_counter = 0; |
83 | |||
84 | /* Remove an entry from the boost tracker */ | ||
85 | int l = strlen(cpu_boost_tracker); | ||
86 | while (l >= 0 && cpu_boost_tracker[l] != id) | ||
87 | l--; | ||
88 | if (cpu_boost_tracker[l] != id) /* No match found? */ | ||
89 | l = strlen(cpu_boost_tracker)-1; /* Just remove last one */ | ||
90 | while (l < CPU_BOOST_TRACKER_MAX) | ||
91 | { | ||
92 | cpu_boost_tracker[l] = cpu_boost_tracker[l+1]; | ||
93 | l++; | ||
94 | } | ||
61 | } | 95 | } |
62 | } | 96 | } |
97 | #endif | ||
98 | |||
99 | void cpu_boost(bool on_off) | ||
100 | { | ||
101 | cpu_boost_id(on_off, '?'); | ||
102 | } | ||
63 | 103 | ||
64 | void cpu_idle_mode(bool on_off) | 104 | void cpu_idle_mode(bool on_off) |
65 | { | 105 | { |