mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 04:45:17 +03:00
Debug timers added (use -DDEBUG_TIMERS=YES to enable and CLI command "print dt" to see them)
This commit is contained in:
parent
a8aa6148e5
commit
2990e9b9a3
11 changed files with 517 additions and 276 deletions
|
@ -423,10 +423,37 @@ void printTaskSwitchLog()
|
|||
delete[] tsl;
|
||||
serialCrlf();
|
||||
}
|
||||
|
||||
|
||||
#endif // #if defined(DEBUG_TASKS)
|
||||
|
||||
#if defined(DEBUG_TIMERS)
|
||||
|
||||
void printDebugTime(uint32_t time)
|
||||
{
|
||||
if (time >= 30000) {
|
||||
serialPrintf("%dms", time/1000);
|
||||
}
|
||||
else {
|
||||
serialPrintf("%d.%03dms", time/1000, time%1000);
|
||||
}
|
||||
}
|
||||
|
||||
void printDebugTimer(const char * name, DebugTimer & timer)
|
||||
{
|
||||
serialPrintf("%s: ", name);
|
||||
printDebugTime( timer.getMin());
|
||||
serialPrintf(" - ");
|
||||
printDebugTime(timer.getMax());
|
||||
serialCrlf();
|
||||
timer.reset();
|
||||
}
|
||||
void printDebugTimers()
|
||||
{
|
||||
for(int n = 0; n < DEBUG_TIMERS_COUNT; n++) {
|
||||
printDebugTimer(debugTimerNames[n], debugTimers[n]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int cliDisplay(const char ** argv)
|
||||
{
|
||||
long long int address = 0;
|
||||
|
@ -531,6 +558,9 @@ int cliDisplay(const char ** argv)
|
|||
case 2:
|
||||
tim = TIM2;
|
||||
break;
|
||||
case 13:
|
||||
tim = TIM13;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -558,12 +588,17 @@ int cliDisplay(const char ** argv)
|
|||
else if (!strcmp(argv[1], "int")) {
|
||||
printInterrupts();
|
||||
}
|
||||
#endif //#if defined(DEBUG_INTERRUPTS)
|
||||
#endif
|
||||
#if defined(DEBUG_TASKS)
|
||||
else if (!strcmp(argv[1], "tsl")) {
|
||||
printTaskSwitchLog();
|
||||
}
|
||||
#endif //#if defined(DEBUG_TASKS)
|
||||
#endif
|
||||
#if defined(DEBUG_TIMERS)
|
||||
else if (!strcmp(argv[1], "dt")) {
|
||||
printDebugTimers();
|
||||
}
|
||||
#endif
|
||||
else if (toLongLongInt(argv, 1, &address) > 0) {
|
||||
int size = 256;
|
||||
if (toInt(argv, 2, &size) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue