This commit is contained in:
Quentin Dufour 2020-01-16 18:08:04 +00:00
parent aa32e6d1fe
commit 3a6a9055d3

View file

@ -25,6 +25,7 @@ def compute_interval_distri(s):
for inter, val in s['per_interval'].items(): for inter, val in s['per_interval'].items():
progress = round(processed / to_process * 100) progress = round(processed / to_process * 100)
print(f"{progress}%", end="\r") print(f"{progress}%", end="\r")
#print(val[0]['lats'][0:10])
x = sorted(functools.reduce(lambda acc, v: acc + v['lats'], val, [])) x = sorted(functools.reduce(lambda acc, v: acc + v['lats'], val, []))
s['per_interval_res'][inter] = tool_distri(x, default_perc) s['per_interval_res'][inter] = tool_distri(x, default_perc)
processed += 1 processed += 1
@ -36,8 +37,9 @@ def extract_measlat(log, s):
for l in f: for l in f:
x = re.search(r'Packet (\d+) latency (\d+)µs with', l) x = re.search(r'Packet (\d+) latency (\d+)µs with', l)
if x: if x:
lat = x.groups()[0] pkt = int(x.groups()[0])
s['current']['max_pkt'] = max(s['current']['max_pkt'], int(lat)) lat = int(x.groups()[1])
s['current']['max_pkt'] = max(s['current']['max_pkt'], pkt)
s['current']['lats'].append(lat) s['current']['lats'].append(lat)
def extract_info(inf, s): def extract_info(inf, s):
@ -95,9 +97,17 @@ def analyze_failure(s):
score = idx/total score = idx/total
f.write(f"{rate},{e},{score}\n") 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): def analyze(s):
print("analyzing...") print("analyzing...")
analyze_failure(s) analyze_failure(s)
analyze_interval(s)
state = {'failure': {}, 'per_interval': {}, 'per_interval_res': {}} state = {'failure': {}, 'per_interval': {}, 'per_interval_res': {}}
extract(sys.argv[1], state) extract(sys.argv[1], state)