-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleparser.py
58 lines (52 loc) · 1.72 KB
/
simpleparser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
#BASE_DIR = '/mnt/testouts/initial/stor02_fio_large_weds21/'
#BASE_DIR = '/Users/ace/perftesting/testouts/J02FIO/'
BASE_DIR = '/Users/ace/perftesting/smfio/stor02_fio_100GB_fri23/'
def main():
outstr = ""
#first we find all the target files
target_file_paths = get_target_file_paths()
print target_file_paths
target_file_paths.sort()
#then we parse them
for target in target_file_paths:
outstr += '********** ' + target + ' **********\n'
outstr = outstr + parse_target(target)
#then we print them
print outstr
def parse_target(target):
outstr = ""
#first open file
tfile = open(BASE_DIR + target)
#next extract relevent lines
#first skip first few lines
tfile.readline()#YCSB client
tfile.readline()#commandline call
tfile.readline()#connection line
#grab overall lines
outstr += tfile.readline()#overall runtime
outstr += tfile.readline()#overall throughput
#loop over file till end
#grab out all lines with "Operations" and the next 5 lines
line = tfile.readline()
while line:
if "Operations" in line and "CLEANUP" not in line:
outstr += line #Operations
outstr += tfile.readline() #AvgLat
outstr += tfile.readline() #MinLat
outstr += tfile.readline() #MaxLat
outstr += tfile.readline() #95
outstr += tfile.readline() #99
line = tfile.readline()
#return string
return outstr
def get_target_file_paths():
targets = []
#find all files in the base_dir
files = os.listdir(BASE_DIR)
for file in files:
if 'workload' in file:
targets.append(file)
return targets
if __name__ == '__main__':
main()