def main(args): """Main entry point Args: args: The command line arguments to the program Returns: 0 on success or a non-zero failure code Exceptions: Exceptions thrown by validate_bench """ if len(args) != 2: return print_and_exit("Usage: %s <bench.out file> <bench.out schema>" % sys.argv[0], os.EX_USAGE) try: bench.parse_bench(args[0], args[1]) except IOError as e: return print_and_exit("IOError(%d): %s" % (e.errno, e.strerror), os.EX_OSFILE) except bench.validator.ValidationError as e: return print_and_exit("Invalid benchmark output: %s" % e.message, os.EX_DATAERR) except bench.validator.SchemaError as e: return print_and_exit("Invalid schema: %s" % e.message, os.EX_DATAERR) print("Benchmark output in %s is valid." % args[0]) return os.EX_OK
def main(args): """Main entry point Args: args: The command line arguments to the program Returns: 0 on success or a non-zero failure code Exceptions: Exceptions thrown by validate_bench """ if len(args) != 2: return print_and_exit( "Usage: %s <bench.out file> <bench.out schema>" % sys.argv[0], os.EX_USAGE) try: bench.parse_bench(args[0], args[1]) except IOError as e: return print_and_exit("IOError(%d): %s" % (e.errno, e.strerror), os.EX_OSFILE) except bench.validator.ValidationError as e: return print_and_exit("Invalid benchmark output: %s" % e.message, os.EX_DATAERR) except bench.validator.SchemaError as e: return print_and_exit("Invalid schema: %s" % e.message, os.EX_DATAERR) print("Benchmark output in %s is valid." % args[0]) return os.EX_OK
def main(args): """Program Entry Point Take two benchmark output files and compare their timings. """ if len(args) > 4 or len(args) < 3: print('Usage: %s <schema> <file1> <file2> [threshold in %%]' % sys.argv[0]) sys.exit(os.EX_USAGE) bench1 = bench.parse_bench(args[1], args[0]) bench2 = bench.parse_bench(args[2], args[0]) if len(args) == 4: threshold = float(args[3]) else: threshold = 10.0 if (bench1['timing_type'] != bench2['timing_type']): print('Cannot compare benchmark outputs: timing types are different') return plot_graphs(bench1, bench2) bench.compress_timings(bench1) bench.compress_timings(bench2) compare_runs(bench1, bench2, threshold)
def main(bench1, bench2, schema, threshold, stats): bench1 = bench.parse_bench(bench1, schema) bench2 = bench.parse_bench(bench2, schema) plot_graphs(bench1, bench2) bench.compress_timings(bench1) bench.compress_timings(bench2) compare_runs(bench1, bench2, threshold, stats)
def main(bench1, bench2, schema, threshold, stats): bench1 = bench.parse_bench(bench1, schema) bench.do_for_all_timings( bench1, lambda b, f, v: b['functions'][f][v]['timings'].sort()) bench2 = bench.parse_bench(bench2, schema) bench.do_for_all_timings( bench2, lambda b, f, v: b['functions'][f][v]['timings'].sort()) plot_graphs(bench1, bench2) bench.compress_timings(bench1) bench.compress_timings(bench2) compare_runs(bench1, bench2, threshold, stats)