diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-02-06 23:09:51 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-02-06 23:15:28 -0500 |
commit | 739ff465a7c10b28406fd2a65ac4ba366aef049e (patch) | |
tree | 003f473271b218a5c9dd7056a30724a6ac208b2f /scripts | |
parent | 6cd1e794f7352d8c18fa2e2b8adf49c8e41ceba9 (diff) | |
download | kutter-739ff465a7c10b28406fd2a65ac4ba366aef049e.tar.gz kutter-739ff465a7c10b28406fd2a65ac4ba366aef049e.tar.xz kutter-739ff465a7c10b28406fd2a65ac4ba366aef049e.zip |
logextract: Support reordering API Server messages by timestamp
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/logextract.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/logextract.py b/scripts/logextract.py index 937c68ec..d65026cf 100755 --- a/scripts/logextract.py +++ b/scripts/logextract.py @@ -324,10 +324,28 @@ class GCodeStream: f.close() return self.gcode_stream +api_cmd_r = re.compile(r"^Received " + time_s + r": \{.*\}$") + +# API server shutdowm message parsing +class APIStream: + def __init__(self): + self.api_stream = [] + def parse_line(self, line_num, line): + m = api_cmd_r.match(line) + if m is not None: + ts = float(m.group('time')) + self.api_stream.append((ts, line_num, line)) + return True, None + return False, None + def get_lines(self): + return self.api_stream + stats_r = re.compile(r"^Stats " + time_s + ": ") mcu_r = re.compile(r"MCU '(?P<mcu>[^']+)' (is_)?shutdown: (?P<reason>.*)$") gcode_r = re.compile(r"Dumping gcode input " + count_s + r" blocks$") gcode_state_r = re.compile(r"^gcode state: ") +api_r = re.compile(r"Dumping " + count_s + r" requests for client " + + r"(?P<client>[0-9]+)" + r"$") # Stats message parsing and high-level message dispatch class StatsStream: @@ -389,6 +407,9 @@ class StatsStream: if m is not None: self.gcode_stream.handle_gcode_state(line) return True, None + m = api_r.match(line) + if m is not None: + return True, APIStream() return False, None def get_lines(self): # Ignore old stats |