34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Audit tcp_client-style run logs (the E / V1 series) by their own step markers.
|
|
# Real freeze = a step was sent but its match line never appeared (long gap).
|
|
# ASCII output only.
|
|
import glob, os, re, sys
|
|
|
|
def clean(s):
|
|
return re.sub(r"\x1b\[[0-9;]*m", "", s)
|
|
|
|
def audit(path):
|
|
sent = {}
|
|
matched = set()
|
|
order = []
|
|
for line in open(path, encoding="utf-8-sig", errors="replace"):
|
|
c = clean(line)
|
|
m = re.search(r"\[[\d:.]+\]\s+\[\.\.\]\s+.*?(\d+):\s+(\d+)B", c)
|
|
if m:
|
|
step = int(m.group(1))
|
|
if step not in sent:
|
|
sent[step] = int(m.group(2))
|
|
order.append(step)
|
|
m2 = re.search(r"\[[\d:.]+\]\s+\[OK\]\s+(\d+)B\s", c)
|
|
if m2:
|
|
matched.add(int(m2.group(1)))
|
|
return order, sent, matched
|
|
|
|
for path in sorted(glob.glob("MDK-ARM/ab_E*.log")) + sorted(glob.glob("MDK-ARM/ab_V1_run*.log")) + sorted(glob.glob("MDK-ARM/ab_V1f_run*.log")):
|
|
order, sent, matched = audit(path)
|
|
res = []
|
|
for step in order:
|
|
size = sent[step]
|
|
res.append("s%d(%dB)=%s" % (step, size, "OK" if size in matched else "NO-ECHO"))
|
|
print("%-22s %s" % (os.path.basename(path), " ".join(res) if res else "(no step lines)"))
|