summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-05-26 00:26:08 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2016-12-12 13:20:10 +0100
commit17277fa1bfb21acf1b880b15db0e799bc623c276 (patch)
treed701fd1cfb0c134761efdd3a8b220ecc09275af0 /firmware/target/arm
parenta523c3fcfe40734f3b15fbf086578fa188fc0ec6 (diff)
downloadrockbox-17277fa1bfb21acf1b880b15db0e799bc623c276.tar.gz
rockbox-17277fa1bfb21acf1b880b15db0e799bc623c276.zip
imx233: add more icoll statistics
Those new statistics give the maximum time an IRQ took and also the total time spent in IRQ, for each IRQ. Hopefully those do not take took much time or space to collect. If this is the case, it can be enabled in debug builds only the future. Change-Id: I05af172897c5cb7ffcc9322452f974d8f968e29d
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c2
-rw-r--r--firmware/target/arm/imx233/icoll-imx233.c15
-rw-r--r--firmware/target/arm/imx233/icoll-imx233.h8
3 files changed, 21 insertions, 4 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index 68865efc8d..e33f2ab1ad 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -637,7 +637,7 @@ bool dbg_hw_info_icoll(void)
637 static char prio[4] = {'-', '+', '^', '!'}; 637 static char prio[4] = {'-', '+', '^', '!'};
638 lcd_putsf(0, j, "%c%s", prio[info.priority & 3], dbg_irqs[i].name); 638 lcd_putsf(0, j, "%c%s", prio[info.priority & 3], dbg_irqs[i].name);
639 if(info.enabled || info.freq > 0) 639 if(info.enabled || info.freq > 0)
640 lcd_putsf(11, j, "%d", info.freq); 640 lcd_putsf(11, j, "%d %d %d", info.freq, info.max_time, info.total_time);
641 } 641 }
642 lcd_update(); 642 lcd_update();
643 yield(); 643 yield();
diff --git a/firmware/target/arm/imx233/icoll-imx233.c b/firmware/target/arm/imx233/icoll-imx233.c
index d5c6e48a89..f20ce97ea9 100644
--- a/firmware/target/arm/imx233/icoll-imx233.c
+++ b/firmware/target/arm/imx233/icoll-imx233.c
@@ -26,6 +26,7 @@
26#include "timrot-imx233.h" 26#include "timrot-imx233.h"
27 27
28#include "regs/icoll.h" 28#include "regs/icoll.h"
29#include "regs/digctl.h"
29 30
30/* helpers */ 31/* helpers */
31#if IMX233_SUBTARGET >= 3600 && IMX233_SUBTARGET < 3780 32#if IMX233_SUBTARGET >= 3600 && IMX233_SUBTARGET < 3780
@@ -140,6 +141,10 @@ static isr_t isr_table[INT_SRC_COUNT] =
140 141
141static uint32_t irq_count_old[INT_SRC_COUNT]; 142static uint32_t irq_count_old[INT_SRC_COUNT];
142static uint32_t irq_count[INT_SRC_COUNT]; 143static uint32_t irq_count[INT_SRC_COUNT];
144static uint32_t irq_max_time_old[INT_SRC_COUNT];
145static uint32_t irq_max_time[INT_SRC_COUNT];
146static uint32_t irq_tot_time_old[INT_SRC_COUNT];
147static uint32_t irq_tot_time[INT_SRC_COUNT];
143 148
144unsigned imx233_icoll_get_priority(int src) 149unsigned imx233_icoll_get_priority(int src)
145{ 150{
@@ -160,6 +165,8 @@ struct imx233_icoll_irq_info_t imx233_icoll_get_irq_info(int src)
160#endif 165#endif
161 info.priority = imx233_icoll_get_priority(src); 166 info.priority = imx233_icoll_get_priority(src);
162 info.freq = irq_count_old[src]; 167 info.freq = irq_count_old[src];
168 info.max_time = irq_max_time_old[src];
169 info.total_time = irq_tot_time_old[src];
163 return info; 170 return info;
164} 171}
165 172
@@ -172,6 +179,10 @@ static void do_irq_stat(void)
172 counter = 0; 179 counter = 0;
173 memcpy(irq_count_old, irq_count, sizeof(irq_count)); 180 memcpy(irq_count_old, irq_count, sizeof(irq_count));
174 memset(irq_count, 0, sizeof(irq_count)); 181 memset(irq_count, 0, sizeof(irq_count));
182 memcpy(irq_max_time_old, irq_max_time, sizeof(irq_max_time));
183 memset(irq_max_time, 0, sizeof(irq_max_time));
184 memcpy(irq_tot_time_old, irq_tot_time, sizeof(irq_tot_time));
185 memset(irq_tot_time, 0, sizeof(irq_tot_time));
175 } 186 }
176} 187}
177 188
@@ -195,8 +206,12 @@ void _irq_handler(void)
195 do_irq_stat(); 206 do_irq_stat();
196 /* enable interrupts again */ 207 /* enable interrupts again */
197 //enable_irq(); 208 //enable_irq();
209 uint32_t time = HW_DIGCTL_MICROSECONDS;
198 /* process interrupt */ 210 /* process interrupt */
199 (*(isr_t *)vec)(); 211 (*(isr_t *)vec)();
212 time = HW_DIGCTL_MICROSECONDS - time;
213 irq_max_time[irq_nr] = MAX(irq_max_time[irq_nr], time);
214 irq_tot_time[irq_nr] += time;
200 /* acknowledge completion of IRQ */ 215 /* acknowledge completion of IRQ */
201 HW_ICOLL_LEVELACK = 1 << imx233_icoll_get_priority(irq_nr); 216 HW_ICOLL_LEVELACK = 1 << imx233_icoll_get_priority(irq_nr);
202} 217}
diff --git a/firmware/target/arm/imx233/icoll-imx233.h b/firmware/target/arm/imx233/icoll-imx233.h
index 20b93648c9..1815c70384 100644
--- a/firmware/target/arm/imx233/icoll-imx233.h
+++ b/firmware/target/arm/imx233/icoll-imx233.h
@@ -74,9 +74,11 @@
74 74
75struct imx233_icoll_irq_info_t 75struct imx233_icoll_irq_info_t
76{ 76{
77 bool enabled; 77 bool enabled; /* is IRQ currently enabled ? */
78 unsigned freq; 78 unsigned freq; /* how many times was IRQ fired in the past second */
79 unsigned priority; 79 unsigned priority; /* IRQ priority (0-3) */
80 unsigned max_time; /* maximum time spent in one IRQ during the past second (in us) */
81 unsigned total_time; /* total time spent in IRQ during the past second (in us) */
80}; 82};
81 83
82void imx233_icoll_init(void); 84void imx233_icoll_init(void);