diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-01-22 10:41:25 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-01-22 10:41:25 +0000 |
commit | f8c68c7912da50451167fe4bcfd69717f2a30c98 (patch) | |
tree | b0d03c2488adabfda26823d9bcd3eeaa422b3ce2 /firmware | |
parent | a3a303e440d751fbbb8c2532640098bfc969b75f (diff) | |
download | rockbox-f8c68c7912da50451167fe4bcfd69717f2a30c98.tar.gz rockbox-f8c68c7912da50451167fe4bcfd69717f2a30c98.zip |
Simple cpu boost tracker for LOGF builds. Shows the last 64 cpu_boost() calls from the debug menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12087 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/system.h | 18 | ||||
-rw-r--r-- | firmware/system.c | 48 |
2 files changed, 64 insertions, 2 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index 688cf9bc15..6b53b88639 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -56,22 +56,38 @@ bool detect_flashed_romimage(void); | |||
56 | bool detect_flashed_ramimage(void); | 56 | bool detect_flashed_ramimage(void); |
57 | bool detect_original_firmware(void); | 57 | bool detect_original_firmware(void); |
58 | 58 | ||
59 | #if defined(HAVE_ADJUSTABLE_CPU_FREQ) \ | ||
60 | && defined(ROCKBOX_HAS_LOGF) | ||
61 | #define CPU_BOOST_LOGGING | ||
62 | #endif | ||
63 | |||
59 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 64 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
60 | #define FREQ cpu_frequency | 65 | #define FREQ cpu_frequency |
61 | void set_cpu_frequency(long frequency); | 66 | void set_cpu_frequency(long frequency); |
67 | #ifdef CPU_BOOST_LOGGING | ||
68 | char * cpu_boost_log_getlog_first(void); | ||
69 | char * cpu_boost_log_getlog_next(void); | ||
70 | int cpu_boost_log_getcount(void); | ||
71 | void cpu_boost_(bool on_off, char* location, int line); | ||
72 | #else | ||
62 | void cpu_boost(bool on_off); | 73 | void cpu_boost(bool on_off); |
74 | #endif | ||
63 | void cpu_idle_mode(bool on_off); | 75 | void cpu_idle_mode(bool on_off); |
64 | int get_cpu_boost_counter(void); | 76 | int get_cpu_boost_counter(void); |
65 | #else | 77 | #else |
66 | #define FREQ CPU_FREQ | 78 | #define FREQ CPU_FREQ |
67 | #define set_cpu_frequency(frequency) | 79 | #define set_cpu_frequency(frequency) |
68 | #define cpu_boost(on_off) | 80 | #define cpu_boost(on_off,location) |
69 | #define cpu_boost_id(on_off, id) | 81 | #define cpu_boost_id(on_off, id) |
70 | #define cpu_idle_mode(on_off) | 82 | #define cpu_idle_mode(on_off) |
71 | #define get_cpu_boost_counter() | 83 | #define get_cpu_boost_counter() |
72 | #define get_cpu_boost_tracker() | 84 | #define get_cpu_boost_tracker() |
73 | #endif | 85 | #endif |
74 | 86 | ||
87 | #ifdef CPU_BOOST_LOGGING | ||
88 | #define cpu_boost(on_off) cpu_boost_(on_off,__FILE__, __LINE__) | ||
89 | #endif | ||
90 | |||
75 | #define BAUDRATE 9600 | 91 | #define BAUDRATE 9600 |
76 | 92 | ||
77 | #ifndef NULL | 93 | #ifndef NULL |
diff --git a/firmware/system.c b/firmware/system.c index c9ce086f0a..49f01df0cd 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -39,9 +39,55 @@ int get_cpu_boost_counter(void) | |||
39 | { | 39 | { |
40 | return boost_counter; | 40 | return boost_counter; |
41 | } | 41 | } |
42 | 42 | #ifdef CPU_BOOST_LOGGING | |
43 | #define MAX_BOOST_LOG 64 | ||
44 | static char cpu_boost_calls[MAX_BOOST_LOG][MAX_PATH]; | ||
45 | static int cpu_boost_first = 0; | ||
46 | static int cpu_boost_calls_count = 0; | ||
47 | static int cpu_boost_track_message = 0; | ||
48 | int cpu_boost_log_getcount(void) | ||
49 | { | ||
50 | return cpu_boost_calls_count; | ||
51 | } | ||
52 | char * cpu_boost_log_getlog_first(void) | ||
53 | { | ||
54 | if (cpu_boost_calls_count) | ||
55 | { | ||
56 | cpu_boost_track_message = 1; | ||
57 | return cpu_boost_calls[cpu_boost_first]; | ||
58 | } | ||
59 | else return NULL; | ||
60 | } | ||
61 | char * cpu_boost_log_getlog_next(void) | ||
62 | { | ||
63 | int message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; | ||
64 | if (cpu_boost_track_message < cpu_boost_calls_count) | ||
65 | { | ||
66 | cpu_boost_track_message++; | ||
67 | return cpu_boost_calls[message]; | ||
68 | } | ||
69 | else return NULL; | ||
70 | } | ||
71 | void cpu_boost_(bool on_off, char* location, int line) | ||
72 | { | ||
73 | if (cpu_boost_calls_count == MAX_BOOST_LOG) | ||
74 | { | ||
75 | cpu_boost_first = (cpu_boost_first+1)%MAX_BOOST_LOG; | ||
76 | cpu_boost_calls_count--; | ||
77 | if (cpu_boost_calls_count < 0) | ||
78 | cpu_boost_calls_count = 0; | ||
79 | } | ||
80 | if (cpu_boost_calls_count < MAX_BOOST_LOG) | ||
81 | { | ||
82 | int message = (cpu_boost_first+cpu_boost_calls_count)%MAX_BOOST_LOG; | ||
83 | snprintf(cpu_boost_calls[message], MAX_PATH, | ||
84 | "%c %s:%d",on_off==true?'B':'U',location,line); | ||
85 | cpu_boost_calls_count++; | ||
86 | } | ||
87 | #else | ||
43 | void cpu_boost(bool on_off) | 88 | void cpu_boost(bool on_off) |
44 | { | 89 | { |
90 | #endif | ||
45 | if(on_off) | 91 | if(on_off) |
46 | { | 92 | { |
47 | /* Boost the frequency if not already boosted */ | 93 | /* Boost the frequency if not already boosted */ |