From ee273f052077fbc5cab42d15b0ee7bf6a7b6d6f6 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 5 Feb 2020 09:37:33 +0100 Subject: [PATCH] parse results --- scripts/dcallan.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/dcallan.py b/scripts/dcallan.py index 50287b0..0eca0b1 100755 --- a/scripts/dcallan.py +++ b/scripts/dcallan.py @@ -55,15 +55,23 @@ def extract_dcall(f, s): return False def aggregate_failed_pct(s): - k = s['current']['strat'] + k = (s['current']['strat'], s['current']['mode']) + if k not in s['failed_1pct']: s['failed_1pct'][k] = 0 if s['current']['success_buf'] < 16500 * 0.99: s['failed_1pct'][k] += 1 + + if k not in s['failed_5pct']: s['failed_5pct'][k] = 0 + if s['current']['success_buf'] < 16500 * 0.95: s['failed_5pct'][k] += 1 + + if k not in s['run_per_strat']: s['run_per_strat'][k] = 0 + s['run_per_strat'][k] += 1 + return True def extract_folder(f, s): return \ extract_info(f + '/info.txt', s) and \ - extract_dcall(f + '/log/server-dcall-gstreamer.log', s) and \ + extract_dcall(f + '/log/client-dcall-gstreamer.log', s) and \ aggregate_failed_pct(s) def extract(p, s): @@ -82,7 +90,16 @@ def extract(p, s): print(f"{progress}%", end="\r") print("done") -state = {'failed_1pct': {}} -extract(sys.argv[1], state) -print(state) +def output_res(s): + with open('dcall_drop.csv', 'w') as f: + f.write("mode,strat,threshold,ratio\n") + for thr_name, thr_val in [('failed_1pct', 0.01), ('failed_5pct', 0.05)]: + for key,val in s[thr_name].items(): + mode, strat = key + ratio = val / s['run_per_strat'][key] + f.write(f"{mode},{strat},{thr_val},{ratio}\n") + +state = {'failed_1pct': {}, 'failed_5pct': {}, 'run_per_strat': {}} +extract(sys.argv[1], state) +output_res(state)