2019-09-23 18:08:04 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import sys,re
|
|
|
|
|
2019-09-26 07:55:38 +00:00
|
|
|
print("run,packet_id,measure_type,latency,latency_ms")
|
|
|
|
for i in range(1,len(sys.argv)):
|
|
|
|
path = sys.argv[i]
|
2019-09-26 09:41:07 +00:00
|
|
|
client_server = f"{sys.argv[i]}/log/server-measlat-stdout.log"
|
|
|
|
server_client = f"{sys.argv[i]}/log/client-measlat-stdout.log"
|
2019-09-26 07:55:38 +00:00
|
|
|
run = path
|
2019-09-23 18:08:04 +00:00
|
|
|
|
2019-09-26 07:55:38 +00:00
|
|
|
agg = {}
|
|
|
|
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 }
|
2019-09-23 18:08:04 +00:00
|
|
|
|
2019-09-26 07:55:38 +00:00
|
|
|
with open(server_client, '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)
|
|
|
|
if not pkt_id in agg: agg[pkt_id] = {}
|
|
|
|
agg[pkt_id]["server_client"] = lat
|
2019-09-23 18:08:04 +00:00
|
|
|
|
2019-09-26 07:55:38 +00:00
|
|
|
for packet_id, lats in agg.items():
|
|
|
|
if "client_server" not in lats or "server_client" not in lats: continue
|
|
|
|
print(f"{run},{packet_id},client_server,{lats['client_server']},{lats['client_server'] / 1000}")
|
|
|
|
print(f"{run},{packet_id},server_client,{lats['server_client']},{lats['server_client'] / 1000}")
|
|
|
|
print(f"{run},{packet_id},delta,{lats['client_server'] - lats['server_client']},{(lats['client_server'] - lats['server_client'])/1000}")
|
|
|
|
print(f"{run},{packet_id},delta_abs,{abs(lats['client_server'] - lats['server_client'])},{abs(lats['client_server'] - lats['server_client'])/1000}")
|