diff options
| author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-05-26 00:26:08 +0100 |
|---|---|---|
| committer | Amaury Pouly <amaury.pouly@gmail.com> | 2016-12-12 13:20:10 +0100 |
| commit | 17277fa1bfb21acf1b880b15db0e799bc623c276 (patch) | |
| tree | d701fd1cfb0c134761efdd3a8b220ecc09275af0 | |
| parent | a523c3fcfe40734f3b15fbf086578fa188fc0ec6 (diff) | |
| download | rockbox-17277fa1bfb21acf1b880b15db0e799bc623c276.zip rockbox-17277fa1bfb21acf1b880b15db0e799bc623c276.tar.gz rockbox-17277fa1bfb21acf1b880b15db0e799bc623c276.tar.bz2 rockbox-17277fa1bfb21acf1b880b15db0e799bc623c276.tar.xz | |
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
| -rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 2 | ||||
| -rw-r--r-- | firmware/target/arm/imx233/icoll-imx233.c | 15 | ||||
| -rw-r--r-- | firmware/target/arm/imx233/icoll-imx233.h | 8 |
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 68865ef..e33f2ab 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) static char prio[4] = {'-', '+', '^', '!'}; lcd_putsf(0, j, "%c%s", prio[info.priority & 3], dbg_irqs[i].name); if(info.enabled || info.freq > 0) - lcd_putsf(11, j, "%d", info.freq); + lcd_putsf(11, j, "%d %d %d", info.freq, info.max_time, info.total_time); } lcd_update(); yield(); diff --git a/firmware/target/arm/imx233/icoll-imx233.c b/firmware/target/arm/imx233/icoll-imx233.c index d5c6e48..f20ce97 100644 --- a/firmware/target/arm/imx233/icoll-imx233.c +++ b/firmware/target/arm/imx233/icoll-imx233.c @@ -26,6 +26,7 @@ #include "timrot-imx233.h" #include "regs/icoll.h" +#include "regs/digctl.h" /* helpers */ #if IMX233_SUBTARGET >= 3600 && IMX233_SUBTARGET < 3780 @@ -140,6 +141,10 @@ static isr_t isr_table[INT_SRC_COUNT] = static uint32_t irq_count_old[INT_SRC_COUNT]; static uint32_t irq_count[INT_SRC_COUNT]; +static uint32_t irq_max_time_old[INT_SRC_COUNT]; +static uint32_t irq_max_time[INT_SRC_COUNT]; +static uint32_t irq_tot_time_old[INT_SRC_COUNT]; +static uint32_t irq_tot_time[INT_SRC_COUNT]; unsigned imx233_icoll_get_priority(int src) { @@ -160,6 +165,8 @@ struct imx233_icoll_irq_info_t imx233_icoll_get_irq_info(int src) #endif info.priority = imx233_icoll_get_priority(src); info.freq = irq_count_old[src]; + info.max_time = irq_max_time_old[src]; + info.total_time = irq_tot_time_old[src]; return info; } @@ -172,6 +179,10 @@ static void do_irq_stat(void) counter = 0; memcpy(irq_count_old, irq_count, sizeof(irq_count)); memset(irq_count, 0, sizeof(irq_count)); + memcpy(irq_max_time_old, irq_max_time, sizeof(irq_max_time)); + memset(irq_max_time, 0, sizeof(irq_max_time)); + memcpy(irq_tot_time_old, irq_tot_time, sizeof(irq_tot_time)); + memset(irq_tot_time, 0, sizeof(irq_tot_time)); } } @@ -195,8 +206,12 @@ void _irq_handler(void) do_irq_stat(); /* enable interrupts again */ //enable_irq(); + uint32_t time = HW_DIGCTL_MICROSECONDS; /* process interrupt */ (*(isr_t *)vec)(); + time = HW_DIGCTL_MICROSECONDS - time; + irq_max_time[irq_nr] = MAX(irq_max_time[irq_nr], time); + irq_tot_time[irq_nr] += time; /* acknowledge completion of IRQ */ HW_ICOLL_LEVELACK = 1 << imx233_icoll_get_priority(irq_nr); } diff --git a/firmware/target/arm/imx233/icoll-imx233.h b/firmware/target/arm/imx233/icoll-imx233.h index 20b9364..1815c70 100644 --- a/firmware/target/arm/imx233/icoll-imx233.h +++ b/firmware/target/arm/imx233/icoll-imx233.h @@ -74,9 +74,11 @@ struct imx233_icoll_irq_info_t { - bool enabled; - unsigned freq; - unsigned priority; + bool enabled; /* is IRQ currently enabled ? */ + unsigned freq; /* how many times was IRQ fired in the past second */ + unsigned priority; /* IRQ priority (0-3) */ + unsigned max_time; /* maximum time spent in one IRQ during the past second (in us) */ + unsigned total_time; /* total time spent in IRQ during the past second (in us) */ }; void imx233_icoll_init(void); |