aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Ogden <bernie.ogden@linaro.org>2014-07-01 06:20:04 +0100
committerBernard Ogden <bernie.ogden@linaro.org>2014-07-01 07:50:23 +0100
commit74b9922b587668b5cfb0e187699528223acc96b8 (patch)
treeffe141228d3d5769131ed8b917063894934a77f8
parent100e3a553280db91087db5510170434f6ea4c4e9 (diff)
Add a dry run option
Useful for testing, for driving bare metal runs
-rw-r--r--scripts/bench.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts/bench.py b/scripts/bench.py
index 8caf050..8537f0b 100644
--- a/scripts/bench.py
+++ b/scripts/bench.py
@@ -52,6 +52,8 @@ FUNCTIONS = sorted(ALIGNMENTS.keys())
NUM_RUNS = 5
+DRY_RUN = False
+
def run(cache, variant, function, bytes, loops, alignment, run_id, quiet=False):
"""Perform a single run, exercising the cache as appropriate."""
key = ':'.join('%s' % x for x in (variant, function, bytes, loops, alignment, run_id))
@@ -62,10 +64,14 @@ def run(cache, variant, function, bytes, loops, alignment, run_id, quiet=False):
xbuild = build + "/try-"
cmd = '%(xbuild)s%(variant)s -t %(function)s -c %(bytes)s -l %(loops)s -a %(alignment)s -r %(run_id)s' % locals()
- try:
- got = subprocess.check_output(cmd.split()).strip()
- except OSError, ex:
- assert False, 'Error %s while running %s' % (ex, cmd)
+ if(DRY_RUN):
+ print cmd
+ return 1
+ else:
+ try:
+ got = subprocess.check_output(cmd.split()).strip()
+ except OSError, ex:
+ assert False, 'Error %s while running %s' % (ex, cmd)
parts = got.split(':')
took = float(parts[7])
@@ -132,10 +138,12 @@ def run_top(cache):
parser.add_argument("-f", "--functions", nargs="+", help="function to run (run all if not specified)", default = FUNCTIONS, choices = FUNCTIONS)
parser.add_argument("-l", "--limit", type=int, help="upper limit to test to (in bytes)", default = 512*1024)
parser.add_argument("-p", "--prefix", help="path to executables, relative to CWD", default=".")
+ parser.add_argument("-d", "--dry-run", help="Dry run: just print the invocations that we would use", default=False, action="store_true")
args = parser.parse_args()
- global build
+ global build, DRY_RUN
build = args.prefix
+ DRY_RUN = args.dry_run
bytes = []