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