Rework parsing script
This commit is contained in:
parent
73b385cd77
commit
2d7aa27883
1 changed files with 28 additions and 25 deletions
|
@ -1,31 +1,34 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import sys,re
|
import sys,re
|
||||||
|
|
||||||
owd = f"./out/{sys.argv[1]}/log/server-udpecho-stdout.log"
|
print("run,packet_id,measure_type,latency,latency_ms")
|
||||||
rtt = f"./out/{sys.argv[1]}/res/{sys.argv[2]}.csv"
|
for i in range(1,len(sys.argv)):
|
||||||
|
path = sys.argv[i]
|
||||||
|
client_server = f"{sys.argv[1]}/log/server-measlat-stdout.log"
|
||||||
|
server_client = f"{sys.argv[1]}/log/client-measlat-stdout.log"
|
||||||
|
run = path
|
||||||
|
|
||||||
agg = {}
|
agg = {}
|
||||||
last_pkt = 0
|
with open(client_server, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
res = re.match(r".*Packet (\d+) latency (\d+)µs", line)
|
||||||
|
if not res: continue
|
||||||
|
pkt_id,lat = res.groups()
|
||||||
|
pkt_id,lat = int(pkt_id), int(lat)
|
||||||
|
agg[pkt_id] = {"client_server": lat }
|
||||||
|
|
||||||
with open(owd, 'r') as f:
|
with open(server_client, 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
res = re.match(r".*Packet (\d+) latency (\d+)µs", line)
|
res = re.match(r".*Packet (\d+) latency (\d+)µs", line)
|
||||||
if not res: continue
|
if not res: continue
|
||||||
pkt_id,lat = res.groups()
|
pkt_id,lat = res.groups()
|
||||||
pkt_id,lat = int(pkt_id), int(lat)
|
pkt_id,lat = int(pkt_id), int(lat)
|
||||||
agg[pkt_id] = {"owd": lat }
|
if not pkt_id in agg: agg[pkt_id] = {}
|
||||||
|
agg[pkt_id]["server_client"] = lat
|
||||||
|
|
||||||
with open(rtt, 'r') as f:
|
for packet_id, lats in agg.items():
|
||||||
for line in f:
|
if "client_server" not in lats or "server_client" not in lats: continue
|
||||||
res = re.match(r".*Packet (\d+) latency (\d+)µs", line)
|
print(f"{run},{packet_id},client_server,{lats['client_server']},{lats['client_server'] / 1000}")
|
||||||
if not res: continue
|
print(f"{run},{packet_id},server_client,{lats['server_client']},{lats['server_client'] / 1000}")
|
||||||
pkt_id,lat = res.groups()
|
print(f"{run},{packet_id},delta,{lats['client_server'] - lats['server_client']},{(lats['client_server'] - lats['server_client'])/1000}")
|
||||||
pkt_id,lat = int(pkt_id), int(lat)
|
print(f"{run},{packet_id},delta_abs,{abs(lats['client_server'] - lats['server_client'])},{abs(lats['client_server'] - lats['server_client'])/1000}")
|
||||||
agg[pkt_id]["rtt"] = lat
|
|
||||||
last_pkt = pkt_id
|
|
||||||
|
|
||||||
for i in range(last_pkt):
|
|
||||||
if i not in agg: continue
|
|
||||||
if "rtt" not in agg[i]: continue
|
|
||||||
|
|
||||||
print(abs((agg[i]["rtt"] - 2*agg[i]["owd"]) / 1000), agg[i]["owd"] / 1000, (agg[i]["rtt"] - agg[i]["owd"]) / 1000, i)
|
|
||||||
|
|
Loading…
Reference in a new issue