~linaro-toolchain-dev/cortex-strings/trunk

« back to all changes in this revision

Viewing changes to scripts/bench.py

  • Committer: Dr. David Alan Gilbert
  • Date: 2011-09-15 14:42:16 UTC
  • Revision ID: david.gilbert@linaro.org-20110915144216-kk6rof244pkok53t
Take out references to eglibc add on

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
 
3
 
"""Simple harness that benchmarks different variants of the routines,
4
 
caches the results, and emits all of the records at the end.
5
 
 
6
 
Results are generated for different values of:
7
 
 * Source
8
 
 * Routine
9
 
 * Length
10
 
 * Alignment
11
 
"""
12
 
 
13
3
import subprocess
14
4
import math
15
5
import sys
17
7
# Prefix to the executables
18
8
build = '../build/try-'
19
9
 
20
 
ALL = 'memchr memcmp memcpy memset strchr strcmp strcpy strlen'
 
10
DEFAULTS = 'memcpy memset memchr strchr strcmp strcpy strlen'
21
11
 
22
12
HAS = {
23
 
    'this': 'bounce memchr memcpy memset strchr strcpy strlen',
24
 
    'bionic': 'memcmp memcpy memset strcmp strcpy strlen',
25
 
    'bionic-c': ALL,
26
 
    'csl': 'memcpy memset',
27
 
    'glibc': 'memcpy memset strlen',
28
 
    'glibc-c': ALL,
29
 
    'newlib': 'memcpy strcmp strcpy strlen',
30
 
    'newlib-c': ALL,
31
 
    'newlib-xscale': 'memchr memcpy memset strchr strcmp strcpy strlen',
 
13
    'this': 'bounce ' + DEFAULTS,
 
14
    'bionic': DEFAULTS,
 
15
    'glibc': DEFAULTS,
 
16
    'newlib': DEFAULTS,
 
17
    'newlib-xscale': DEFAULTS,
32
18
    'plain': 'memset memcpy strcmp strcpy',
 
19
    'csl': 'memcpy memset'
33
20
}
34
21
 
35
22
def run(cache, variant, function, bytes, loops, alignment=8, quiet=False):
110
97
    step1 = 2.0
111
98
    # Test intermediate powers of 1.4
112
99
    step2 = 1.4
 
100
 
 
101
    # Figure out how many steps get us up to the top
 
102
    steps1 = int(round(math.log(top) / math.log(step1)))
 
103
    steps2 = int(round(math.log(top) / math.log(step2)))
113
104
    
114
105
    bytes = []
115
 
    
116
 
    for step in [step1, step2]:
117
 
        if step:
118
 
            # Figure out how many steps get us up to the top
119
 
            steps = int(round(math.log(top) / math.log(step)))
120
 
            bytes.extend([int(step**x) for x in range(0, steps+1)])
 
106
    bytes.extend([int(step1**x) for x in range(0, steps1+1)])
 
107
    bytes.extend([int(step2**x) for x in range(0, steps2+1)])
121
108
 
122
109
    alignments = [8, 16, 4, 1, 2, 32]
123
110
 
141
128
        run_top(cache)
142
129
    finally:
143
130
        with open(cachename, 'w') as f:
144
 
            for line in sorted(cache.values()):
 
131
            for line in cache.values():
145
132
                print >> f, line
146
133
 
147
134
if __name__ == '__main__':