From d6df2bc98bebe2b6699a94e21a42380208eefd3c Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Mon, 18 Nov 2013 13:17:49 -0800 Subject: [PATCH] Small fixups to benchmarking --- benchmark/bin/run_all.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/benchmark/bin/run_all.py b/benchmark/bin/run_all.py index 1113766..10c53ce 100755 --- a/benchmark/bin/run_all.py +++ b/benchmark/bin/run_all.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import print_function from subprocess import Popen, PIPE import sys @@ -8,7 +9,7 @@ import argparse def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument('-l', "--langs", help="Add languages to test with the form: pycapnp:pycapnp", action='append', default=['pycapnp', 'pyproto', 'pyproto_cpp']) + parser.add_argument('-l', "--langs", help="Add languages to test, ie: -l capnproto -l protobuf", action='append', default=['pycapnp', 'pyproto', 'pyproto_cpp']) parser.add_argument("-r", "--reuse", help="If this flag is passed, re-use tests will be run", action='store_true',) parser.add_argument("-c", "--compression", help="If this flag is passed, compression tests will be run", action='store_true') parser.add_argument("-i", "--scale_iters", help="Scaling factor to multiply the default iters by", type=float, default=1.0) @@ -25,15 +26,21 @@ def run_cpp(prefix, name, mode, iters, faster, compression): if compression != 'none': res_type += '_' + compression - p = Popen(["time", "-p", prefix+"-"+name, mode, reuse, compression, str(iters)], stdout=PIPE, stderr=PIPE) + command = ["time", "-p", prefix+"-"+name, mode, reuse, compression, str(iters)] + p = Popen(command, stdout=PIPE, stderr=PIPE) res = p.communicate()[1] data = {} - res = res.strip() - for line in res.split('\n'): - vals = line.split() - data[vals[0]] = float(vals[1]) + if p.returncode != 0: + sys.stderr.write(' '.join(command) + ' failed to run with errors: ' + res + '\n') + sys.stderr.flush() + else: + res = res.strip() + + for line in res.split('\n'): + vals = line.split() + data[vals[0]] = float(vals[1]) data['type'] = res_type data['mode'] = mode @@ -62,7 +69,6 @@ def run_each(name, langs, reuse, compression, iters): def main(): args = parse_args() - del os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] os.environ['PATH'] += ':.' data = []