run-in-simulavr.sh: add statistics output for LED On Time.
As it's still a bit cumbersome to go through the whole .vcd file to find the highest delay between On and Off, do this search automatically and output an statistics. Can look like this: Statistics (assuming a 20 MHz clock): LED on occurences: 838. Sum of all LED on time: 262055 clock cycles. LED on time minimum: 306 clock cycles. LED on time maximum: 717 clock cycles. LED on time average: 312.715 clock cycles. This should give an reasonable overview of wether and roughly how much a particular code change makes your code slower or faster. It should also show up showblockers, like occasionally huge delays. BTW., the above data was collected timing the step interrupt when running short-moves.gcode with the current firmware.
This commit is contained in:
parent
da08c35edd
commit
fdfd202e5d
|
|
@ -176,6 +176,10 @@ EOF
|
||||||
xPos = yPos = 0;
|
xPos = yPos = 0;
|
||||||
lastxTime = lastyTime = 0;
|
lastxTime = lastyTime = 0;
|
||||||
ledOnTime = 0;
|
ledOnTime = 0;
|
||||||
|
|
||||||
|
ledTimeMin = ledTimeMax = 0;
|
||||||
|
ledTimeCount = 0;
|
||||||
|
ledTimeSum = 0;
|
||||||
}
|
}
|
||||||
/^#/ {
|
/^#/ {
|
||||||
time = substr($0, 2);
|
time = substr($0, 2);
|
||||||
|
|
@ -236,12 +240,34 @@ EOF
|
||||||
ledOnTime = time;
|
ledOnTime = time;
|
||||||
} else { # falling flange
|
} else { # falling flange
|
||||||
print time " b" bit " " ledID;
|
print time " b" bit " " ledID;
|
||||||
if (ledOnTime != 0) { # ignore pin initialisation
|
if (ledOnTime != 0) {
|
||||||
print ledOnTime " b" print_binary(time - ledOnTime, 32) " " ledTimeID;
|
ledTime = time - ledOnTime;
|
||||||
|
print ledOnTime " b" print_binary(ledTime, 32) " " ledTimeID;
|
||||||
|
ledTime /= 50; # Convert from nanoseconds to clock cycles.
|
||||||
|
if (ledTimeMin == 0 || ledTime < ledTimeMin) {
|
||||||
|
ledTimeMin = ledTime;
|
||||||
|
}
|
||||||
|
if (ledTime > ledTimeMax) {
|
||||||
|
ledTimeMax = ledTime;
|
||||||
|
}
|
||||||
|
ledTimeCount++;
|
||||||
|
ledTimeSum += ledTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
END {
|
||||||
|
if (ledTimeCount > 0) {
|
||||||
|
print "Statistics (assuming a 20 MHz clock): " > "/dev/stderr";
|
||||||
|
print "LED on occurences: " ledTimeCount "." > "/dev/stderr";
|
||||||
|
print "Sum of all LED on time: " ledTimeSum " clock cycles." > "/dev/stderr";
|
||||||
|
print "LED on time minimum: " ledTimeMin " clock cycles." > "/dev/stderr";
|
||||||
|
print "LED on time maximum: " ledTimeMax " clock cycles." > "/dev/stderr";
|
||||||
|
print "LED on time average: " ledTimeSum / ledTimeCount " clock cycles." > "/dev/stderr";
|
||||||
|
} else {
|
||||||
|
print "Debug LED apparently unused." > "/dev/stderr";
|
||||||
|
}
|
||||||
|
}
|
||||||
' < "${VCD_FILE}" | \
|
' < "${VCD_FILE}" | \
|
||||||
sort -g | \
|
sort -g | \
|
||||||
awk '
|
awk '
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue