7
build = '../build/try-'
10
def run(cache, variant, function, bytes, loops):
11
key = ':'.join('%s' % x for x in (variant, function, bytes, loops))
17
cmd = '%(xbuild)s%(variant)s -t %(function)s -c %(bytes)s -l %(loops)s' % locals()
19
got = subprocess.check_output(cmd.split()).strip()
26
def run_bytes(cache, variant, function, bytes):
28
loops = int(500000000/5 / math.sqrt(b))
29
run(cache, variant, function, b, loops)
32
def run_functions(cache, variant, functions, bytes):
33
for function in functions:
34
run_bytes(cache, variant, function, bytes)
38
'this': 'strcmp strcpy memchr strchr strlen memcpy memset',
39
'bionc': 'strlen memset memcpy',
40
'glibc': 'memset strlen memcpy strcmp strcpy memchr strchr',
41
'newlib': 'strcmp strlen strcpy',
42
'plain': 'memset memcpy strcmp strcpy',
43
'csl': 'memcpy memset'
47
def run_variant(cache, variant, bytes):
48
functions = HAS[variant].split()
49
run_functions(cache, variant, functions, bytes)
52
def run_variants(cache, variants, bytes):
53
for variant in variants:
54
run_variant(cache, variant, bytes)
59
bytes = [2**x for x in range(1, 12)]
60
run_variants(cache, variants, bytes)
64
cachename = 'cache.txt'
69
with open(cachename) as f:
72
parts = line.split(':')
73
cache[':'.join(parts[:4])] = line
80
with open(cachename, 'w') as f:
81
for line in cache.values():