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

« back to all changes in this revision

Viewing changes to scripts/plot.py

  • Committer: Michael Hope
  • Date: 2012-06-07 04:03:16 UTC
  • Revision ID: michael.hope@linaro.org-20120607040316-77gxs050hetjqqfo
Tweak the plotter.  Fix support for results with an anlignment field.
Put the 'this' results at the top of the stack.  Log more friendly
errors.  Shrink the legend.  Use powers of two for the semilog range.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
import pylab
10
10
 
11
 
Record = collections.namedtuple('Record', 'variant test size loops rawtime comment time bytes rate')
 
11
Record = collections.namedtuple('Record', 'variant test size loops alignment rawtime comment time bytes rate')
12
12
 
13
13
def unique(rows, name):
14
14
    """Takes a list of values, pulls out the named field, and returns
76
76
            v.sort(key=lambda x: x.size)
77
77
            V = pylab.array([(x.size, getattr(x, field)) for x in v])
78
78
 
 
79
            # Ensure our results appear
 
80
            order = 1 if variant == 'this' else 0
 
81
 
79
82
            try:
80
83
                # A little hack.  We want the 'all' to be obvious on
81
84
                # the graph
83
86
                    pylab.scatter(V[:,0], V[:,1]/scale, label=variant)
84
87
                    pylab.plot(V[:,0], V[:,1]/scale)
85
88
                else:
86
 
                    pylab.plot(V[:,0], V[:,1]/scale, label=variant)
 
89
                    pylab.plot(V[:,0], V[:,1]/scale, label=variant, zorder=order)
87
90
 
88
91
            except Exception, ex:
89
92
                # michaelh1 likes to run this script while the test is
90
93
                # still running which can lead to bad data
91
 
                print ex
 
94
                print ex, 'on %s of %s' % (variant, test)
92
95
 
93
 
        pylab.legend(loc='lower right')
94
 
        pylab.semilogx()
 
96
        pylab.legend(loc='lower right', ncol=2, prop={'size': 'small'})
95
97
        pylab.xlabel('Block size (B)')
96
98
        pylab.ylabel(ylabel)
97
99
        pylab.title('%s %s' % (test, field))
98
100
        pylab.grid()
99
101
 
100
102
        pylab.savefig('%s-%s.png' % (test, field), dpi=100)
101
 
        pylab.semilogx()
 
103
        pylab.semilogx(basex=2)
102
104
        pylab.savefig('%s-%s-semilog.png' % (test, field), dpi=100)
103
105
        pylab.clf()
104
106