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

« back to all changes in this revision

Viewing changes to scripts/bench.py

  • Committer: Michael Hope
  • Date: 2012-06-12 03:38:14 UTC
  • Revision ID: michael.hope@linaro.org-20120612033814-w4xxjhr3r8b4ilk0
Update the list of variants and routines in each.  Rework how the
steps are calculated.  Sort the cache to make it easier to fiddle
with.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# Prefix to the executables
18
18
build = '../build/try-'
19
19
 
20
 
DEFAULTS = 'memcpy memset memchr strchr strcmp strcpy strlen'
 
20
ALL = 'memchr memcmp memcpy memset strchr strcmp strcpy strlen'
21
21
 
22
22
HAS = {
23
 
    'this': 'bounce ' + DEFAULTS,
24
 
    'bionic': DEFAULTS,
25
 
    'glibc': DEFAULTS,
26
 
    'newlib': DEFAULTS,
27
 
    'newlib-xscale': DEFAULTS,
 
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',
28
32
    'plain': 'memset memcpy strcmp strcpy',
29
 
    'csl': 'memcpy memset'
30
33
}
31
34
 
32
35
def run(cache, variant, function, bytes, loops, alignment=8, quiet=False):
107
110
    step1 = 2.0
108
111
    # Test intermediate powers of 1.4
109
112
    step2 = 1.4
110
 
 
111
 
    # Figure out how many steps get us up to the top
112
 
    steps1 = int(round(math.log(top) / math.log(step1)))
113
 
    steps2 = int(round(math.log(top) / math.log(step2)))
114
113
    
115
114
    bytes = []
116
 
    bytes.extend([int(step1**x) for x in range(0, steps1+1)])
117
 
    bytes.extend([int(step2**x) for x in range(0, steps2+1)])
 
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)])
118
121
 
119
122
    alignments = [8, 16, 4, 1, 2, 32]
120
123
 
138
141
        run_top(cache)
139
142
    finally:
140
143
        with open(cachename, 'w') as f:
141
 
            for line in cache.values():
 
144
            for line in sorted(cache.values()):
142
145
                print >> f, line
143
146
 
144
147
if __name__ == '__main__':