tor_multipath_voip/scripts/fastprobe.py

30 lines
737 B
Python
Raw Normal View History

2019-11-03 16:03:54 +00:00
#!/usr/bin/python3
# Packet 7495 latency 153496µs with flag 0 sent on link 6 with vanilla 0
import sys,re
groupmap = {"0": "fast", "1": "probe"}
redmap = {"1": "orig", "0": "pad"}
res = {}
seen = set()
2020-01-13 16:48:35 +00:00
vals = 0
2019-11-03 16:03:54 +00:00
for line in sys.stdin:
if "~ measlat ~" in line:
seen = set()
continue
m = re.match(r".*Packet (\d+) latency (\d+)µs with flag (\d) sent on link (\d+) with vanilla (\d)", line)
if not m: continue
if m[1] in seen: continue
seen.add(m[1])
group = groupmap[m[3]]
red = redmap[m[5]]
if (group, red) not in res: res[(group,red)] = 0
res[(group,red)] += 1
2020-01-13 16:48:35 +00:00
vals += 1
2019-11-03 16:03:54 +00:00
print("group,redundancy,count")
for key,val in res.items():
g,r = key
2020-01-13 16:48:35 +00:00
print(f"{g},{r},{val/vals}")