1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 12:55:12 +03:00

Interrupt counters added (use -DDEBUG_INTERRUPTS=YES to enable and CLI command "print int" to see them)

This commit is contained in:
Damjan Adamic 2016-03-27 22:40:40 +02:00
parent a0b4053e82
commit 9673df83a7
21 changed files with 188 additions and 52 deletions

View file

@ -357,6 +357,22 @@ int cliSet(const char ** argv)
return 0;
}
#if defined(DEBUG_INTERRUPTS)
void printInterrupts()
{
__disable_irq();
struct InterruptCounters ic = interruptCounters;
memset(&interruptCounters, 0, sizeof(interruptCounters));
interruptCounters.resetTime = get_tmr10ms();
__enable_irq();
serialPrint("Interrupts count in the last %u ms:", (get_tmr10ms() - ic.resetTime) * 10);
for(int n = 0; n < INT_LAST; n++) {
serialPrint("%s: %u", interruptNames[n], ic.cnt[n]);
}
}
#endif //#if defined(DEBUG_INTERRUPTS)
int cliDisplay(const char ** argv)
{
long long int address = 0;
@ -484,6 +500,11 @@ int cliDisplay(const char ** argv)
serialPrint(" CCR4 0x%x", tim->CCR4);
}
}
#if defined(DEBUG_INTERRUPTS)
else if (!strcmp(argv[1], "int")) {
printInterrupts();
}
#endif //#if defined(DEBUG_INTERRUPTS)
else if (toLongLongInt(argv, 1, &address) > 0) {
int size = 256;
if (toInt(argv, 2, &size) >= 0) {