Improve jantoran

This commit is contained in:
Quentin Dufour 2020-01-20 08:44:37 +00:00
parent a3c41400ec
commit bfc5c4fc29
1 changed files with 9 additions and 5 deletions

View File

@ -46,11 +46,16 @@ def extract_info(inf, s):
with open(inf) as f:
full = ''.join(f.readlines())
x = re.search(r'orig-server (\d+) (\d+) \d+', full)
s['current']['npkt'] = int(x.groups()[0])
s['current']['interval'] = int(x.groups()[1])
if x:
s['current']['npkt'] = int(x.groups()[0])
s['current']['interval'] = int(x.groups()[1])
return True
else:
print("read error for",inf)
return False
def extract_folder(p, s):
extract_info(p + '/info.txt', s)
if not extract_info(p + '/info.txt', s): return False
extract_measlat(p + '/log/client-measlat-stdout.log', s)
compute_failure(s)
@ -70,8 +75,7 @@ def extract(p, s):
print("extracting...")
for folder in os.listdir(p):
s['current'] = {}
extract_folder(p + '/' + folder, s)
categorize(folder, s)
extract_folder(p + '/' + folder, s) and categorize(folder, s)
counter += 1
progress = round(counter / item_count * 100)
print(f"{progress}%", end="\r")