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

« back to all changes in this revision

Viewing changes to scripts/plot-align.py

  • Committer: Matthew Gretton-Dann
  • Author(s): Marcus Shawcroft
  • Date: 2013-01-16 20:55:59 UTC
  • mto: This revision was merged to the branch mainline in revision 99.
  • Revision ID: matthew.gretton-dann@linaro.org-20130116205559-7nye0l7d8fvzdye3
This patch fixes an issue in the AArch64 strnlen implementation which
occurs if  ULONG_MAX-15 <= n <= ULONG_MAX.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
"""Plot the performance of different variants of one routine versus alignment.
 
4
"""
 
5
 
 
6
import libplot
 
7
 
 
8
import pylab
 
9
 
 
10
 
 
11
def plot(records, bytes, function):
 
12
    records = [x for x in records if x.bytes==bytes and x.function==function]
 
13
 
 
14
    variants = libplot.unique(records, 'variant', prefer='this')
 
15
    alignments = libplot.unique(records, 'alignment')
 
16
 
 
17
    X = pylab.arange(len(alignments))
 
18
    width = 1.0/(len(variants)+1)
 
19
 
 
20
    colours = iter('bgrcmyk')
 
21
 
 
22
    pylab.figure(1).set_size_inches((16, 12))
 
23
    pylab.clf()
 
24
 
 
25
    for i, variant in enumerate(variants):
 
26
        heights = []
 
27
 
 
28
        for alignment in alignments:
 
29
            matches = [x for x in records if x.variant==variant and x.alignment==alignment]
 
30
 
 
31
            if matches:
 
32
                match = matches[0]
 
33
                heights.append(match.bytes*match.loops/match.elapsed/(1024*1024))
 
34
            else:
 
35
                heights.append(0)
 
36
 
 
37
        pylab.bar(X+i*width, heights, width, color=colours.next(), label=variant)
 
38
 
 
39
 
 
40
    axes = pylab.axes()
 
41
    axes.set_xticklabels(alignments)
 
42
    axes.set_xticks(X + 0.5)
 
43
 
 
44
    pylab.title('Performance of different variants of %(function)s for %(bytes)d byte blocks' % locals())
 
45
    pylab.ylabel('Rate (MB/s)')
 
46
    pylab.legend(loc='upper left', ncol=3)
 
47
    pylab.grid()
 
48
    pylab.savefig('alignment-%(function)s-%(bytes)d.png' % locals(), dpi=72)
 
49
 
 
50
def main():
 
51
    records = libplot.parse()
 
52
 
 
53
    for function in libplot.unique(records, 'function'):
 
54
        for bytes in libplot.unique(records, 'bytes'):
 
55
            plot(records, bytes, function)
 
56
 
 
57
    pylab.show()
 
58
 
 
59
if __name__ == '__main__':
 
60
    main()