aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Ogden <benie.ogden@linaro.org>2014-07-03 07:43:31 +0100
committerBernard Ogden <benie.ogden@linaro.org>2014-07-03 07:43:31 +0100
commit4e3fbf65a386a8968dd6bc981bbd6286d6a4cf51 (patch)
tree60ef532851496b0818341620c2b651c6eceda8c8
parente204f6d55faa64dada885318a1e404f64f6a389e (diff)
CLI-twiddleable alignment
-rw-r--r--scripts/bench.py47
1 files changed, 28 insertions, 19 deletions
diff --git a/scripts/bench.py b/scripts/bench.py
index b6efcc9..f7cc6db 100644
--- a/scripts/bench.py
+++ b/scripts/bench.py
@@ -15,45 +15,49 @@ import subprocess
import math
import sys
-ALL = 'memchr memcmp memcpy memset strchr strcmp strcpy strlen'
+SINGLE_BUFFER_FUNCTIONS = ['strchr', 'memset', 'strlen', 'memchr']
+DUAL_BUFFER_FUNCTIONS = ['memcmp', 'memcpy', 'strcmp', 'strcpy']
+
+FUNCTIONS = list(SINGLE_BUFFER_FUNCTIONS)
+FUNCTIONS.extend(DUAL_BUFFER_FUNCTIONS)
HAS = {
'this': 'bounce memchr memcpy memset strchr strcpy strlen',
'bionic-a9': 'memcmp memcpy memset strcmp strcpy strlen',
'bionic-a15': 'memcmp memcpy memset strcmp strcpy strlen',
- 'bionic-c': ALL,
+ 'bionic-c': FUNCTIONS,
'csl': 'memcpy memset',
'glibc': 'memcpy memset strchr strlen',
- 'glibc-c': ALL,
+ 'glibc-c': FUNCTIONS,
'newlib': 'memcpy strcmp strcpy strlen',
- 'newlib-c': ALL,
+ 'newlib-c': FUNCTIONS,
'newlib-xscale': 'memchr memcpy memset strchr strcmp strcpy strlen',
'plain': 'memset memcpy strcmp strcpy',
}
-BOUNCE_ALIGNMENTS = ['1']
-SINGLE_BUFFER_ALIGNMENTS = ['1', '2', '4', '8', '16', '32']
-DUAL_BUFFER_ALIGNMENTS = ['1:32', '2:32', '4:32', '8:32', '16:32', '32:32']
-
ALIGNMENTS = {
- 'bounce': BOUNCE_ALIGNMENTS,
- 'memchr': SINGLE_BUFFER_ALIGNMENTS,
- 'memset': SINGLE_BUFFER_ALIGNMENTS,
- 'strchr': SINGLE_BUFFER_ALIGNMENTS,
- 'strlen': SINGLE_BUFFER_ALIGNMENTS,
- 'memcmp': DUAL_BUFFER_ALIGNMENTS,
- 'memcpy': DUAL_BUFFER_ALIGNMENTS,
- 'strcmp': DUAL_BUFFER_ALIGNMENTS,
- 'strcpy': DUAL_BUFFER_ALIGNMENTS,
+ 'bounce': ['1'],
}
VARIANTS = sorted(HAS.keys())
-FUNCTIONS = sorted(ALIGNMENTS.keys())
NUM_RUNS = 5
DRY_RUN = False
+#CLI helpers
+def parse_alignments(alignment):
+ e = Exception("Alignments must be expressed as colon-separated digits e.g. 8:32 16:16")
+ alignments = alignment.split(':')
+ if len(alignments) != 2:
+ raise e
+ try:
+ [int(x) for x in alignments]
+ except:
+ raise e
+ return alignment
+
+
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))
@@ -141,14 +145,19 @@ def run_top(cache):
parser.add_argument("-s", "--steps", nargs="+", help="steps to test powers of", default = ['1.4', '2.0'])
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")
+ 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'])
args = parser.parse_args()
if(args.lower >= args.upper):
raise Exception("Range starts after it ends!")
- global build, DRY_RUN
+ global build, DRY_RUN, ALIGNMENTS
build = args.prefix
DRY_RUN = args.dry_run
+ for function in SINGLE_BUFFER_FUNCTIONS:
+ ALIGNMENTS[function] = [x.split(':')[0] for x in args.alignments]
+ for function in DUAL_BUFFER_FUNCTIONS:
+ ALIGNMENTS[function] = args.alignments
bytes = []