~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-08-31 04:04:26 UTC
  • Revision ID: michael.hope@linaro.org-20110831040426-fjpxcmw0zmsrh8cp
Added some scripts to run the benchmarks and to plot the results.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
"""Plot the performance for different block sizes of one function across
 
4
variants.
 
5
"""
 
6
 
 
7
import libplot
 
8
 
 
9
import pylab
 
10
import pdb
 
11
 
 
12
def plot(records, function):
 
13
    variants = libplot.unique(records, 'variant')
 
14
    records = [x for x in records if x.function==function]
 
15
 
 
16
    bytes = libplot.unique(records, 'bytes')
 
17
 
 
18
    colours = iter('bgrcmyk')
 
19
 
 
20
    pylab.clf()
 
21
 
 
22
    for variant in variants:
 
23
        matches = [x for x in records if x.variant==variant]
 
24
        matches.sort(key=lambda x: x.bytes)
 
25
 
 
26
        X = [x.bytes for x in matches]
 
27
        Y = [x.bytes*x.loops/x.elapsed/(1024*1024) for x in matches]
 
28
 
 
29
        colour = colours.next()
 
30
 
 
31
        if X:
 
32
            pylab.plot(X, Y, c=colour)
 
33
            pylab.scatter(X, Y, c=colour, label=variant)
 
34
 
 
35
    pylab.legend(loc='upper left')
 
36
    pylab.grid()
 
37
    pylab.title('%s in MB/s' % function)
 
38
    pylab.xlabel('Size (B)')
 
39
    pylab.ylabel('Rate (MB/s)')
 
40
    pylab.semilogx()
 
41
    pylab.xlim(0, max(X))
 
42
    pylab.ylim(0, pylab.ylim()[1])
 
43
 
 
44
def main():
 
45
    records = libplot.parse()
 
46
 
 
47
    functions = libplot.unique(records, 'function')
 
48
 
 
49
    for function in functions:
 
50
        plot(records, function)
 
51
        pylab.savefig('sizes-%s.png' % function)
 
52
 
 
53
if __name__ == '__main__':
 
54
    main()
 
55