From b7a118ffe4ed51fa50b21749c36c996efd157920 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 21 Feb 2024 16:04:17 +0100 Subject: make cat: Support _ms= and _us= output for dfatool's analyze-log.py --- script/cat.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'script') diff --git a/script/cat.py b/script/cat.py index 5a9dbff..22def54 100755 --- a/script/cat.py +++ b/script/cat.py @@ -90,6 +90,20 @@ def handle_line(line): match_line = f"{cycles}/{overflows} cycles" new_line = f"{ms} ms ({cycles}/{overflows} cycles)" print_line = re.sub(match_line, new_line, print_line) + for match in re.finditer("_us=(\d+)/(\d+)", line): + cycles = int(match.group(1)) + overflows = int(match.group(2)) + us = (cycles + timer_overflow * overflows) * 1000000 / counter_freq + match_line = f"_us={cycles}/{overflows}" + new_line = f"_us={us}" + print_line = re.sub(match_line, new_line, print_line) + for match in re.finditer("_ms=(\d+)/(\d+)", line): + cycles = int(match.group(1)) + overflows = int(match.group(2)) + us = (cycles + timer_overflow * overflows) * 1000 / counter_freq + match_line = f"_ms={cycles}/{overflows}" + new_line = f"_ms={ms}" + print_line = re.sub(match_line, new_line, print_line) print(print_line) else: print(line) -- cgit v1.2.3