1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Revert "Add optional loop time monitor."

This reverts commit 7a2beda2a9.
This commit is contained in:
Neil McKechnie 2021-03-09 10:30:20 +00:00
parent 7954c85b7d
commit 62f1c04ee3

View File

@ -134,31 +134,4 @@ void loop()
LCD(2,F("Free RAM=%5db"), ramLowWatermark);
}
#endif
// Optionally report average and maximum loop time
#if ENABLE_LOOP_MEASUREMENT
static unsigned long startTime = micros();
static unsigned int maxElapsed = 0;
static unsigned long totalElapsed = 0;
static unsigned long count = 0;
static unsigned long lastOutput = millis();
unsigned long endTime = micros();
unsigned int elapsed = endTime - startTime;
if (elapsed > maxElapsed) maxElapsed = elapsed;
count++;
totalElapsed += elapsed;
unsigned long currentMillis = millis();
if (currentMillis - lastOutput >= 5000) {
DIAG(F("\nLoop: max=%dus ave=%dus\n"), maxElapsed, totalElapsed/count);
maxElapsed = 0;
totalElapsed = 0;
count = 0;
lastOutput = currentMillis;
}
startTime = micros();
#endif
}