aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/utils/converter_benchmark.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/host/utils/converter_benchmark.py b/host/utils/converter_benchmark.py
index 0f7f32937..d34b019b6 100644
--- a/host/utils/converter_benchmark.py
+++ b/host/utils/converter_benchmark.py
@@ -9,10 +9,10 @@
Wrap the converter_benchmark tool and produce prettier results.
"""
+import sys
import argparse
import csv
import subprocess
-from six import iteritems
INTRO_SETUP = {
'n_samples': {
@@ -38,7 +38,7 @@ TABLE_SETUP = {
def run_benchmark(args):
""" Run the tool with the given arguments, return the section in the {{{ }}} brackets """
call_args = ['./converter_benchmark',]
- for k, v in iteritems(args.__dict__):
+ for k, v in args.__dict__.items():
k = k.replace('_', '-')
if v is None:
continue
@@ -48,18 +48,17 @@ def run_benchmark(args):
continue
call_args.append('--{0}'.format(k))
call_args.append(str(v))
- print(call_args)
try:
output = subprocess.check_output(call_args).decode('utf-8')
except subprocess.CalledProcessError as ex:
- print(ex.output)
- exit(ex.returncode)
+ print("Error running converter_benchmark:", ex.output.decode())
+ sys.exit(ex.returncode)
header_out, csv_output = output.split('{{{', 1)
csv_output = csv_output.split('}}}', 1)
assert len(csv_output) == 2 and csv_output[1].strip() == ''
return header_out, csv_output[0]
-def print_stats_table(args, csv_output):
+def print_stats_table(_, csv_output):
"""
Print stats.
"""
@@ -69,7 +68,7 @@ def print_stats_table(args, csv_output):
for idx, row in enumerate(reader):
if idx == 0:
# Print intro:
- for k, v in iteritems(INTRO_SETUP):
+ for k, v in INTRO_SETUP.items():
print("{title}: {value}".format(
title=v['title'],
value=row[title_row.index(k)],
@@ -159,7 +158,8 @@ def setup_argparse():
)
parser.add_argument(
"--debug-converter", action='store_true',
- help="Skip benchmark and print conversion results. Implies iterations==1 and will only run on a single converter.",
+ help="Skip benchmark and print conversion results. Implies iterations==1 "
+ "and will only run on a single converter.",
)
parser.add_argument(
"--hex", action='store_true',
@@ -180,4 +180,3 @@ def main():
if __name__ == "__main__":
main()
-