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

« back to all changes in this revision

Viewing changes to scripts/bench.py

  • Committer: Will Newton
  • Date: 2013-06-17 07:36:38 UTC
  • Revision ID: will.newton@linaro.org-20130617073638-zkog7j9lp847tkii
Default alignment to 8 bytes rather than relying on malloc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
HAS = {
23
23
    'this': 'bounce memchr memcpy memset strchr strcpy strlen',
24
 
    'bionic': 'memcmp memcpy memset strcmp strcpy strlen',
 
24
    'bionic-a9': 'memcmp memcpy memset strcmp strcpy strlen',
 
25
    'bionic-a15': 'memcmp memcpy memset strcmp strcpy strlen',
25
26
    'bionic-c': ALL,
26
27
    'csl': 'memcpy memset',
27
28
    'glibc': 'memcpy memset strlen',
58
59
 
59
60
    return took
60
61
 
61
 
def run_many(cache, variants, bytes, alignments):
 
62
def run_many(cache, variants, bytes, alignments, all_functions):
62
63
    # We want the data to come out in a useful order.  So fix an
63
64
    # alignment and function, and do all sizes for a variant first
64
65
    bytes = sorted(bytes)
65
66
    mid = bytes[len(bytes)/2]
66
67
 
67
 
    # Use the ordering in 'this' as the default
68
 
    all_functions = HAS['this'].split()
 
68
    if not all_functions:
 
69
        # Use the ordering in 'this' as the default
 
70
        all_functions = HAS['this'].split()
69
71
 
70
 
    # Find all other functions
71
 
    for functions in HAS.values():
72
 
        for function in functions.split():
73
 
            if function not in all_functions:
74
 
                all_functions.append(function)
 
72
        # Find all other functions
 
73
        for functions in HAS.values():
 
74
            for function in functions.split():
 
75
                if function not in all_functions:
 
76
                    all_functions.append(function)
75
77
 
76
78
    for alignment in alignments:
77
79
        for function in all_functions:
103
105
 
104
106
def run_top(cache):
105
107
    variants = sorted(HAS.keys())
 
108
    functions = sys.argv[1:]
106
109
 
107
110
    # Upper limit in bytes to test to
108
111
    top = 512*1024
121
124
 
122
125
    alignments = [8, 16, 4, 1, 2, 32]
123
126
 
124
 
    run_many(cache, variants, bytes, alignments)
 
127
    run_many(cache, variants, bytes, alignments, functions)
125
128
 
126
129
def main():
127
130
    cachename = 'cache.txt'