diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-02-21 16:04:17 +0100 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-02-21 16:04:17 +0100 |
commit | b7a118ffe4ed51fa50b21749c36c996efd157920 (patch) | |
tree | bb5f70c516c98e638eab768432bc74edd54a19fa /script | |
parent | 02168c8615b38b24030018b8e678fde18f391228 (diff) |
make cat: Support _ms= and _us= output for dfatool's analyze-log.py
Diffstat (limited to 'script')
-rwxr-xr-x | script/cat.py | 14 |
1 files changed, 14 insertions, 0 deletions
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) |