tor_multipath_voip/scripts/drop_burst_parse.py

17 lines
328 B
Python
Raw Normal View History

2019-09-17 08:11:58 +00:00
#!/usr/bin/python3
import sys,re,math
2019-09-17 09:18:42 +00:00
run = sys.argv[1]
2019-09-17 08:11:58 +00:00
prev = 0
for line in sys.stdin:
res = re.match(r".*Packet (\d+) latency.*", line)
if not res: continue
pkt_id, = res.groups()
pkt_id = int(pkt_id) - 1
dropped = pkt_id - (prev+1)
if dropped > 0:
2019-09-17 09:18:42 +00:00
print(f"{run},{prev},{pkt_id},{dropped}")
2019-09-17 08:11:58 +00:00
prev = pkt_id