Add a script to parse drop
This commit is contained in:
parent
425091431a
commit
dc6bdaa9de
1 changed files with 20 additions and 0 deletions
20
scripts/drop_parse.py
Executable file
20
scripts/drop_parse.py
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys,re,math
|
||||
|
||||
group_by = int(sys.argv[1])
|
||||
total = int(sys.argv[2])
|
||||
prev = 0
|
||||
bins = [0] * (total // group_by)
|
||||
|
||||
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
|
||||
for missing in range(prev+1,pkt_id):
|
||||
bins[missing // group_by] += 1
|
||||
prev = pkt_id
|
||||
|
||||
for i in range(len(bins)):
|
||||
print(f"{i*group_by}-{(i+1)*group_by-1},{bins[i]}")
|
Loading…
Reference in a new issue