summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-11-12 11:52:01 +0100
committerMagnus Ahltorp <map@kth.se>2015-11-12 11:52:01 +0100
commite75838191faa6635f49e5a58044bc9c9512b73f6 (patch)
tree8dec5c7fee399216842da3c50871848b7ded6443
parent29104c1a8213845957aad3c536582e944de0e85c (diff)
Handle multiple files in parsebenchpermdb2
-rwxr-xr-xtools/parsebench.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/parsebench.py b/tools/parsebench.py
index acf018a..962bcba 100755
--- a/tools/parsebench.py
+++ b/tools/parsebench.py
@@ -18,15 +18,22 @@ def parse_one_line(line):
def main():
parser = argparse.ArgumentParser(description="")
- parser.add_argument('inputfile', help="Input file")
+ parser.add_argument('inputfile', help="Input file", nargs='*')
args = parser.parse_args()
- lines = [parse_one_line(line) for line in open(args.inputfile)]
- iterations = itertools.groupby(lines, lambda x: x[0])
print "<!DOCTYPE html>"
print "<html>"
print "<head>"
print "</head>"
print "<body>"
+ for filename in args.inputfile:
+ parse_one_file(filename)
+ print "</body>"
+ print "</html>"
+
+def parse_one_file(filename):
+ lines = [parse_one_line(line) for line in open(filename)]
+ iterations = itertools.groupby(lines, lambda x: x[0])
+ print "<h1>%s</h1>" % (filename,)
print "<div>"
legend = []
for (i, iteration) in iterations:
@@ -38,7 +45,7 @@ def main():
for (itemn, (item, useconds)) in enumerate(data):
seconds = useconds / 1000000
step = 50 / (len(data) - 1)
- print "<td style='width: %dpx; padding: 0; background-color: hsl(%d, 90%%, %d%%);' title='%s:%s'>" % (seconds, stagen * 90, itemn * step + 40, stage, item)
+ print "<td style='width: %dpx; padding: 0; background-color: hsl(%d, 90%%, %d%%);' title='%s:%s %d'>" % (seconds/4, stagen * 90, itemn * step + 40, stage, item, seconds)
if i == 0:
legend.append("<span style='background-color: hsl(%d, 90%%, %d%%);'>%s</span>" % (stagen * 90, itemn * step + 40, item))
print "&nbsp;"
@@ -53,7 +60,5 @@ def main():
for row in legend:
print row
print "</div>"
- print "</body>"
- print "</html>"
main()