From e75838191faa6635f49e5a58044bc9c9512b73f6 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Thu, 12 Nov 2015 11:52:01 +0100 Subject: Handle multiple files in parsebench --- tools/parsebench.py | 17 +++++++++++------ 1 file 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 "" print "" print "" print "" print "" + for filename in args.inputfile: + parse_one_file(filename) + print "" + print "" + +def parse_one_file(filename): + lines = [parse_one_line(line) for line in open(filename)] + iterations = itertools.groupby(lines, lambda x: x[0]) + print "

%s

" % (filename,) print "
" 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 "" % (seconds, stagen * 90, itemn * step + 40, stage, item) + print "" % (seconds/4, stagen * 90, itemn * step + 40, stage, item, seconds) if i == 0: legend.append("%s" % (stagen * 90, itemn * step + 40, item)) print " " @@ -53,7 +60,5 @@ def main(): for row in legend: print row print "
" - print "" - print "" main() -- cgit v1.1