From 9440abc7e9c615463c9ee5bb6ec1dda699c0cb73 Mon Sep 17 00:00:00 2001 From: Bernard Ogden Date: Mon, 7 Jul 2014 15:20:19 +0100 Subject: Specify from the CLI the number of times to call memcpy --- scripts/bench.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/bench.py b/scripts/bench.py index 39fe8ee..8e1bde4 100644 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -130,7 +130,10 @@ def run_many(cache, variants, bytes, all_functions): for b in sorted(bytes): # Figure out the number of loops to give a roughly consistent run - loops = int(f / math.sqrt(max(1, b))) + if NUM_LOOPS == 0: + loops = int(f / math.sqrt(max(1, b))) + else: + loops = NUM_LOOPS for run_id in range(0, NUM_RUNS): run(cache, variant, function, b, loops, alignment, run_id) @@ -147,12 +150,14 @@ def run_top(cache): parser.add_argument("-d", "--dry-run", help="Dry run: just print the invocations that we would use", default=False, action="store_true") parser.add_argument("-a", "--alignments", nargs="+", type=parse_alignments, help="Alignments, e.g. 2:32 for 2-byte-aligned source to 4-byte-aligned dest. Functions with just a dest use the number before the colon.", default=['1:32', '2:32', '4:32', '8:32', '16:32', '32:32']) parser.add_argument("-r", "--runs", type=int, help="Number of runs of each test", default=5) + parser.add_argument("-o", "--loops", type=int, help="Lock the number of memcpy loops to perform", default = 0) args = parser.parse_args() if(args.lower >= args.upper): raise Exception("Range starts after it ends!") - global build, DRY_RUN, ALIGNMENTS, NUM_RUNS + global build, DRY_RUN, ALIGNMENTS, NUM_RUNS, NUM_LOOPS + NUM_LOOPS = args.loops NUM_RUNS = args.runs build = args.prefix DRY_RUN = args.dry_run -- cgit v1.2.3