WIP jantoran
This commit is contained in:
parent
e0158f1dee
commit
fa1cf50cfd
1 changed files with 31 additions and 5 deletions
|
@ -9,6 +9,24 @@ def tool_distri(arr, perc):
|
||||||
r[str(p)] = arr[round(p * (len(arr) - 1))]
|
r[str(p)] = arr[round(p * (len(arr) - 1))]
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def compute_dropped(s):
|
||||||
|
s['current']['missing'] = []
|
||||||
|
start = 0
|
||||||
|
state = "BROKEN"
|
||||||
|
for missing_pkt in range(s['current']['npkt']+1):
|
||||||
|
if s['current']['crible'][missing_pkt] and state == 'WORKING':
|
||||||
|
state = 'BROKEN'
|
||||||
|
start = missing_pkt
|
||||||
|
elif (not s['current']['crible'][missing_pkt]) and state == 'BROKEN':
|
||||||
|
state = 'WORKING'
|
||||||
|
s['current']['missing'].append((start, missing_pkt-1,missing_pkt-start))
|
||||||
|
|
||||||
|
if state == 'BROKEN':
|
||||||
|
s['current']['missing'].append((start, s['current']['npkt'], 1+s['current']['npkt']-start))
|
||||||
|
|
||||||
|
print(s['current']['missing'])
|
||||||
|
return True
|
||||||
|
|
||||||
def compute_failure(s):
|
def compute_failure(s):
|
||||||
it = (s['current']['strat'], s['current']['mode'])
|
it = (s['current']['strat'], s['current']['mode'])
|
||||||
if it not in s['failure']: s['failure'][it] = []
|
if it not in s['failure']: s['failure'][it] = []
|
||||||
|
@ -17,7 +35,7 @@ def compute_failure(s):
|
||||||
|
|
||||||
def extract_measlat(log, s):
|
def extract_measlat(log, s):
|
||||||
s['current']['max_pkt'] = 0
|
s['current']['max_pkt'] = 0
|
||||||
s['current']['lats'] = []
|
s['current']['crible'] = [True] * (s['current']['npkt']+1)
|
||||||
try:
|
try:
|
||||||
with open(log) as f:
|
with open(log) as f:
|
||||||
for l in f:
|
for l in f:
|
||||||
|
@ -26,9 +44,10 @@ def extract_measlat(log, s):
|
||||||
pkt = int(x.groups()[0])
|
pkt = int(x.groups()[0])
|
||||||
lat = int(x.groups()[1])
|
lat = int(x.groups()[1])
|
||||||
s['current']['max_pkt'] = max(s['current']['max_pkt'], pkt)
|
s['current']['max_pkt'] = max(s['current']['max_pkt'], pkt)
|
||||||
#s['current']['lats'].append(lat)
|
if pkt <= s['current']['npkt']: s['current']['crible'][pkt] = False
|
||||||
return True
|
return True
|
||||||
except:
|
except Exception as e:
|
||||||
|
print("read error", e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def extract_info(inf, s):
|
def extract_info(inf, s):
|
||||||
|
@ -56,7 +75,11 @@ def extract_info(inf, s):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def extract_folder(p, s):
|
def extract_folder(p, s):
|
||||||
return extract_info(p + '/info.txt', s) and extract_measlat(p + '/log/client-measlat-stdout.log', s) and compute_failure(s)
|
return \
|
||||||
|
extract_info(p + '/info.txt', s) and \
|
||||||
|
extract_measlat(p + '/log/client-measlat-stdout.log', s) and \
|
||||||
|
compute_failure(s) and \
|
||||||
|
compute_dropped(s)
|
||||||
|
|
||||||
def categorize(folder, s):
|
def categorize(folder, s):
|
||||||
s[folder] = s['current']
|
s[folder] = s['current']
|
||||||
|
@ -64,6 +87,7 @@ def categorize(folder, s):
|
||||||
i = (s['current']['strat'], s['current']['mode'])
|
i = (s['current']['strat'], s['current']['mode'])
|
||||||
if i not in s['per_strat']: s['per_strat'][i] = []
|
if i not in s['per_strat']: s['per_strat'][i] = []
|
||||||
s['per_strat'][i].append(s['current'])
|
s['per_strat'][i].append(s['current'])
|
||||||
|
return True
|
||||||
|
|
||||||
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)
|
||||||
|
@ -72,7 +96,9 @@ def extract(p, s):
|
||||||
print("extracting...")
|
print("extracting...")
|
||||||
for folder in os.listdir(p):
|
for folder in os.listdir(p):
|
||||||
s['current'] = {}
|
s['current'] = {}
|
||||||
extract_folder(p + '/' + folder, s) and categorize(folder, s)
|
extract_folder(p + '/' + folder, s) and \
|
||||||
|
categorize(folder, s) or \
|
||||||
|
print(f"An error occured with {folder}")
|
||||||
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")
|
||||||
|
|
Loading…
Reference in a new issue