From 3a6a9055d34f7b2cca10cee60461d9a122450f23 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 16 Jan 2020 18:08:04 +0000 Subject: [PATCH] fix bugs --- scripts/jantoran.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/jantoran.py b/scripts/jantoran.py index a0d5df0..38d03d9 100755 --- a/scripts/jantoran.py +++ b/scripts/jantoran.py @@ -25,6 +25,7 @@ def compute_interval_distri(s): for inter, val in s['per_interval'].items(): progress = round(processed / to_process * 100) print(f"{progress}%", end="\r") + #print(val[0]['lats'][0:10]) x = sorted(functools.reduce(lambda acc, v: acc + v['lats'], val, [])) s['per_interval_res'][inter] = tool_distri(x, default_perc) processed += 1 @@ -36,8 +37,9 @@ def extract_measlat(log, s): for l in f: x = re.search(r'Packet (\d+) latency (\d+)µs with', l) if x: - lat = x.groups()[0] - s['current']['max_pkt'] = max(s['current']['max_pkt'], int(lat)) + pkt = int(x.groups()[0]) + lat = int(x.groups()[1]) + s['current']['max_pkt'] = max(s['current']['max_pkt'], pkt) s['current']['lats'].append(lat) def extract_info(inf, s): @@ -95,9 +97,17 @@ def analyze_failure(s): score = idx/total f.write(f"{rate},{e},{score}\n") +def analyze_interval(s): + with open('jan_interval.csv', 'w') as f: + f.write(f"rate,perc,lat\n") + for rate, entr in s['per_interval_res'].items(): + for perc, lat in entr.items(): + f.write(f"{rate},{perc},{lat}\n") + def analyze(s): print("analyzing...") analyze_failure(s) + analyze_interval(s) state = {'failure': {}, 'per_interval': {}, 'per_interval_res': {}} extract(sys.argv[1], state)