This commit is contained in:
Eugen Betke 2018-12-11 22:32:01 +01:00
commit 751a0c2593
3 changed files with 15 additions and 13 deletions

View File

@ -34,13 +34,11 @@ def splitFn(fn:str):
def parseIorOutput(fn):
selffn = fn + ".json"
res = dict()
res = list()
with open(selffn) as f:
data = json.load(f)
#print(json.dumps(data, indent=4))
res.update(data['tests'][0]['Results'][0][0])
#print(data['tests'][0]['Results'][0][0])
#print(res)
res = data['tests'][0]['Results']
return res
@ -126,7 +124,7 @@ class DBWriter:
cols = ["%s %s" % (k,self.map[type(v)]) for k,v in data.items()]
colnames = ','.join(cols)
print(colnames)
query = 'CREATE TABLE p (%s, primary key(filename))' % colnames
query = 'CREATE TABLE p (%s, primary key(filename,iteration))' % colnames
try:
self.conn.execute(query)
except Exception as e:
@ -158,14 +156,17 @@ def main():
for filename in glob.glob(folder + "/*.txt"):
print("Parsing " + filename)
data = dict()
data.update(splitFn(filename))
data.update(parseSysCounters(filename))
data.update(parseIorOutput(filename))
if not tabexists:
print(data)
db.create(data)
tabexists = True
db.insert(data)
ior_result = parseIorOutput(filename)
for i in range(0, len(ior_result)):
data.update(splitFn(filename))
data.update(parseSysCounters(filename))
data.update(ior_result[i][0])
data['iteration'] = i
if not tabexists:
print(data)
db.create(data)
tabexists = True
db.insert(data)
print(data)

View File

@ -0,0 +1 @@
sqlite3 results.db "select * from p where api=\"ime\" and iteration<3 and access==\"write\" order by t,iteration" | column -s"|" -t | head

Binary file not shown.