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

« back to all changes in this revision

Viewing changes to scripts/plot-top.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 results of benchmarking different variants of the string
 
4
routines for one size.
 
5
"""
 
6
 
 
7
import libplot
 
8
 
 
9
import pylab
 
10
 
 
11
 
 
12
def main():
 
13
    bytes = 64
 
14
 
 
15
    records = libplot.parse()
 
16
    records = [x for x in records if x.bytes==bytes]
 
17
 
 
18
    variants = libplot.unique(records, 'variant')
 
19
    functions = libplot.unique(records, 'function')
 
20
 
 
21
    X = pylab.arange(len(functions))
 
22
    width = 1.0/(len(X)+1)
 
23
 
 
24
    colours = iter('bgrcmyk')
 
25
 
 
26
    for i, variant in enumerate(variants):
 
27
        heights = []
 
28
 
 
29
        for function in functions:
 
30
            matches = [x for x in records if x.variant==variant and x.function==function]
 
31
 
 
32
            if matches:
 
33
                match = matches[0]
 
34
                heights.append(match.bytes*match.loops/match.elapsed)
 
35
            else:
 
36
                heights.append(0)
 
37
 
 
38
        pylab.bar(X+i*width, heights, width, color=colours.next(), label=variant)
 
39
 
 
40
    axes = pylab.axes()
 
41
    axes.set_xticklabels(functions)
 
42
    axes.set_xticks(X + 0.5)
 
43
 
 
44
    pylab.legend()
 
45
    pylab.grid()
 
46
    pylab.show()
 
47
 
 
48
if __name__ == '__main__':
 
49
    main()
 
50