Better parsing

This commit is contained in:
Quentin Dufour 2020-01-24 13:34:59 +00:00
parent 585a9dc47a
commit fd2b1966e5

View file

@ -24,7 +24,17 @@ def compute_dropped(s):
if state == 'BROKEN': if state == 'BROKEN':
s['current']['missing'].append((start, s['current']['npkt'], 1+s['current']['npkt']-start)) s['current']['missing'].append((start, s['current']['npkt'], 1+s['current']['npkt']-start))
print(s['current']['missing']) t = s['current']['missing']
t = filter(lambda p: (lambda start, stop, diff: start != 0)(*p), t)
t = filter(lambda p: (lambda start, stop, diff: diff > 25)(*p), t)
t = filter(lambda p: (lambda start, stop, diff: stop != s['current']['npkt'])(*p), t)
t = [x for x in t]
if len(t) > 0:
print(s['current']['identifier'])
print(t)
print('old max pkt', s['current']['max_pkt'])
s['current']['max_pkt'] = min(s['current']['max_pkt'], t[0][0] - 1)
print('new max pkt', s['current']['max_pkt'])
return True return True
def compute_failure(s): def compute_failure(s):
@ -78,8 +88,8 @@ def extract_folder(p, s):
return \ return \
extract_info(p + '/info.txt', s) and \ extract_info(p + '/info.txt', s) and \
extract_measlat(p + '/log/client-measlat-stdout.log', s) and \ extract_measlat(p + '/log/client-measlat-stdout.log', s) and \
compute_failure(s) and \ compute_dropped(s) and \
compute_dropped(s) compute_failure(s)
def categorize(folder, s): def categorize(folder, s):
s[folder] = s['current'] s[folder] = s['current']
@ -95,7 +105,7 @@ def extract(p, s):
counter = 0 counter = 0
print("extracting...") print("extracting...")
for folder in os.listdir(p): for folder in os.listdir(p):
s['current'] = {} s['current'] = { 'identifier': folder}
extract_folder(p + '/' + folder, s) and \ extract_folder(p + '/' + folder, s) and \
categorize(folder, s) or \ categorize(folder, s) or \
print(f"An error occured with {folder}") print(f"An error occured with {folder}")