summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-02-15 15:55:49 +0100
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-02-15 15:55:49 +0100
commitb2487f9f4102d97e9087742a02d97eb1354a73c7 (patch)
tree554e9ccf2a4ce1ee0db6147f856d5150fee61b97
parentde1d2011721f6f56e63382af16cfbace8750b24f (diff)
cat.py: it's counter freq, not cpu freq
-rwxr-xr-xscript/cat.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/script/cat.py b/script/cat.py
index 330669e..5a9dbff 100755
--- a/script/cat.py
+++ b/script/cat.py
@@ -6,7 +6,7 @@ import serial.threaded
import sys
import time
-cpu_freq = None
+counter_freq = None
timer_overflow = None
@@ -81,12 +81,12 @@ class SerialMonitor:
def handle_line(line):
- if cpu_freq is not None:
+ if counter_freq is not None:
print_line = line
for match in re.finditer("(\d+)/(\d+) cycles", line):
cycles = int(match.group(1))
overflows = int(match.group(2))
- ms = (cycles + timer_overflow * overflows) * 1000 / cpu_freq
+ ms = (cycles + timer_overflow * overflows) * 1000 / counter_freq
match_line = f"{cycles}/{overflows} cycles"
new_line = f"{ms} ms ({cycles}/{overflows} cycles)"
print_line = re.sub(match_line, new_line, print_line)
@@ -100,9 +100,9 @@ if __name__ == "__main__":
baud = int(sys.argv[2])
if len(sys.argv) > 4:
- cpu_freq = int(sys.argv[3])
+ counter_freq = int(sys.argv[3])
timer_overflow = int(sys.argv[4])
monitor = SerialMonitor(tty, baud, handle_line)
- time.sleep(5)
+ time.sleep(20)
monitor.close()