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

« back to all changes in this revision

Viewing changes to scripts/libplot.py

  • Committer: Michael Hope
  • Date: 2011-08-31 23:52:05 UTC
  • Revision ID: michael.hope@linaro.org-20110831235205-gwc0igvevvhyyop8
Various updates to the benchmark plotting scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import fileinput
4
4
import collections
5
5
 
6
 
Record = collections.namedtuple('Record', 'variant function bytes loops elapsed rest')
 
6
Record = collections.namedtuple('Record', 'variant function bytes loops alignment elapsed rest')
7
7
 
8
8
 
9
9
def parse_value(v):
10
10
    """Turn text into a primitive"""
11
11
    try:
12
 
        return float(v)
 
12
        if '.' in v:
 
13
            return float(v)
 
14
        else:
 
15
            return int(v)
13
16
    except ValueError:
14
17
        return v
15
18
 
16
19
 
17
 
def unique(records, name):
 
20
def unique(records, name, prefer=''):
18
21
    """Return the unique values of a column in the records"""
19
22
    values = set(getattr(x, name) for x in records)
20
 
    return sorted(values)
 
23
 
 
24
    return sorted(values, key=lambda x: '%d|%s' % (-prefer.find(x), x))
21
25
 
22
26
 
23
27
def parse():