WIP script
This commit is contained in:
parent
77bf180634
commit
61213dbab0
1 changed files with 32 additions and 3 deletions
|
@ -6,12 +6,28 @@ def compute_failure(s):
|
||||||
if it not in s['failure']: s['failure'][it] = []
|
if it not in s['failure']: s['failure'][it] = []
|
||||||
s['failure'][it].append(round(s['current']['max_pkt'] * s['current']['interval'] / 1000 / 60))
|
s['failure'][it].append(round(s['current']['max_pkt'] * s['current']['interval'] / 1000 / 60))
|
||||||
|
|
||||||
|
def compute_circuit_distri(s):
|
||||||
|
s['current']['lats'] = l = sorted(s['current']['lats'])
|
||||||
|
s['current']['distri'] = d = {}
|
||||||
|
perc = lambda p: l[round(p * (len(l) - 1))]
|
||||||
|
for x in [0, 0.25, 0.5, 0.75, 0.99, 0.999, 1]:
|
||||||
|
d[str(x)] = perc(x)
|
||||||
|
|
||||||
|
def compute_interval_distri(s):
|
||||||
|
for inter, val in s['per_interval']:
|
||||||
|
s['per_interval_res'][inter] = {}
|
||||||
|
s['per_interval_res'][inter]['agg'] = sorted([].extend([ elem['lats'] for elem in val]))
|
||||||
|
|
||||||
def extract_measlat(log, s):
|
def extract_measlat(log, s):
|
||||||
|
s['current']['max_pkt'] = 0
|
||||||
|
s['current']['lats'] = []
|
||||||
with open(log) as f:
|
with open(log) as f:
|
||||||
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:
|
||||||
s['current']['max_pkt'] = int(x.groups()[0])
|
lat = x.groups()[0]
|
||||||
|
s['current']['max_pkt'] = max(s['current']['max_pkt'], int(lat))
|
||||||
|
s['current']['lats'].append(lat)
|
||||||
|
|
||||||
def extract_info(inf, s):
|
def extract_info(inf, s):
|
||||||
with open(inf) as f:
|
with open(inf) as f:
|
||||||
|
@ -25,6 +41,14 @@ def extract_folder(p, s):
|
||||||
extract_measlat(p + '/log/client-measlat-stdout.log', s)
|
extract_measlat(p + '/log/client-measlat-stdout.log', s)
|
||||||
|
|
||||||
compute_failure(s)
|
compute_failure(s)
|
||||||
|
compute_circuit_distri(s) if s['current']['interval'] == 40
|
||||||
|
|
||||||
|
def categorize(folder, s):
|
||||||
|
s[folder] = s['current']
|
||||||
|
|
||||||
|
i = s['current']['interval']
|
||||||
|
if i not in s['per_interval']: s['per_interval'][i] = []
|
||||||
|
s['per_interval'][i].append(current)
|
||||||
|
|
||||||
def extract(p, s):
|
def extract(p, s):
|
||||||
item_count = functools.reduce(lambda acc, prev: acc + 1, os.listdir(p), 0)
|
item_count = functools.reduce(lambda acc, prev: acc + 1, os.listdir(p), 0)
|
||||||
|
@ -34,12 +58,16 @@ def extract(p, s):
|
||||||
for folder in os.listdir(p):
|
for folder in os.listdir(p):
|
||||||
s['current'] = {}
|
s['current'] = {}
|
||||||
extract_folder(p + '/' + folder, s)
|
extract_folder(p + '/' + folder, s)
|
||||||
s[folder] = s['current']
|
categorize(folder, s)
|
||||||
counter += 1
|
counter += 1
|
||||||
progress = round(counter / item_count * 100)
|
progress = round(counter / item_count * 100)
|
||||||
print(f"{progress}%", end="\r")
|
print(f"{progress}%", end="\r")
|
||||||
print("done")
|
print("done")
|
||||||
|
|
||||||
|
def compute_global(s):
|
||||||
|
print("computing global...")
|
||||||
|
compute_interval_distri(s)
|
||||||
|
|
||||||
def analyze_failure(s):
|
def analyze_failure(s):
|
||||||
with open('jan_failure.csv', 'w') as f:
|
with open('jan_failure.csv', 'w') as f:
|
||||||
f.write(f"rate,duration,ecdf\n")
|
f.write(f"rate,duration,ecdf\n")
|
||||||
|
@ -60,8 +88,9 @@ def analyze(s):
|
||||||
print("analyzing...")
|
print("analyzing...")
|
||||||
analyze_failure(s)
|
analyze_failure(s)
|
||||||
|
|
||||||
state = {'failure': {}}
|
state = {'failure': {}, 'per_interval': {}, 'per_interval_res': {}}
|
||||||
extract(sys.argv[1], state)
|
extract(sys.argv[1], state)
|
||||||
|
compute_global(state)
|
||||||
analyze(state)
|
analyze(state)
|
||||||
|
|
||||||
#for key, value in state.items():
|
#for key, value in state.items():
|
||||||
|
|
Loading…
Reference in a new issue