-
Notifications
You must be signed in to change notification settings - Fork 1
/
read_summary.py
34 lines (29 loc) · 1.26 KB
/
read_summary.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
import sys, json, pprint
def read_io500_summary(path):
""" Read a result_summary.txt file and return a dict.
For dict format see below.
"""
data = {}
with open(path) as f:
for line in f:
if line.startswith('[RESULT]'):
# [RESULT] ior-easy-write 0.764612 GiB/s : time 34.035 seconds
_, testname, value, unit, _, _, seconds, _ = line.split()
data[testname] = {
'value': float(value),
'unit': unit,
'seconds': float(seconds),
}
if line.startswith('[SCORE ]'): # NB: this will skip invalid scores!
# [SCORE ] Bandwidth 0.585873 GiB/s : IOPS 4.148649 kiops : TOTAL 1.559032
_, _, _, bw, bw_unit, _,_, iops, iops_unit,_,_, total = line.split()
data['score'] = {
'bandwidth': float(bw),
'iops': float(iops),
'bandwidth_unit': bw_unit,
'iops_unit': iops_unit,
'total': float(total),
}
return data
if __name__ == '__main__':
pprint.pprint(read_io500_summary(sys.argv[1]))