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

« back to all changes in this revision

Viewing changes to scripts/plot-sizes.py

  • Committer: Michael Hope
  • Date: 2011-09-08 03:27:40 UTC
  • Revision ID: michael.hope@linaro.org-20110908032740-l0rx3olleapcwk6f
Benchmark more sizes and alignments.  Make the figures bigger to make the text smaller.  Put the 'this' results first.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
import pylab
10
10
import pdb
 
11
import math
11
12
 
12
13
def pretty_kb(v):
13
14
    if v < 1024:
34
35
    colours = iter('bgrcmyk')
35
36
    all_x = []
36
37
 
 
38
    pylab.figure(1).set_size_inches((16, 12))
37
39
    pylab.clf()
38
40
 
 
41
    if 'str' in function:
 
42
        # The harness fills out to 16k.  Anything past that is an
 
43
        # early match
 
44
        top = 16384
 
45
    else:
 
46
        top = 2**31
 
47
 
39
48
    for variant in variants:
40
 
        matches = [x for x in records if x.variant==variant]
 
49
        matches = [x for x in records if x.variant==variant and x.bytes <= top]
41
50
        matches.sort(key=lambda x: x.bytes)
42
51
 
43
52
        X = [x.bytes for x in matches]
48
57
 
49
58
        if X:
50
59
            pylab.plot(X, Y, c=colour)
51
 
            pylab.scatter(X, Y, c=colour, label=variant)
 
60
            pylab.scatter(X, Y, c=colour, label=variant, edgecolors='none')
52
61
 
53
 
    pylab.legend(loc='upper left')
 
62
    pylab.legend(loc='upper left', ncol=3)
54
63
    pylab.grid()
55
64
    pylab.title('%(function)s of %(aalignment)s byte aligned blocks' % locals())
56
65
    pylab.xlabel('Size (B)')
57
66
    pylab.ylabel('Rate (MB/s)')
 
67
 
 
68
    # Figure out how high the range goes
 
69
    top = max(all_x)
 
70
 
 
71
    power = int(round(math.log(max(all_x)) / math.log(2)))
 
72
 
58
73
    pylab.semilogx()
59
 
    pylab.axes().set_xticks([2**x for x in range(0, 15)])
60
 
    pylab.axes().set_xticklabels([pretty_kb(2**x) for x in range(0, 15)])
61
 
    pylab.xlim(0, max(all_x))
 
74
 
 
75
    pylab.axes().set_xticks([2**x for x in range(0, power+1)])
 
76
    pylab.axes().set_xticklabels([pretty_kb(2**x) for x in range(0, power+1)])
 
77
    pylab.xlim(0, top)
62
78
    pylab.ylim(0, pylab.ylim()[1])
63
79
 
64
80
def main():
70
86
    for function in functions:
71
87
        for alignment in alignments:
72
88
            plot(records, function, alignment)
73
 
            pylab.savefig('sizes-%s-%d.png' % (function, alignment))
 
89
            pylab.savefig('sizes-%s-%02d.png' % (function, alignment), dpi=72)
74
90
 
75
91
    pylab.show()
76
92