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

« back to all changes in this revision

Viewing changes to scripts/libplot.py

  • Committer: Will Newton
  • Date: 2013-06-21 14:42:10 UTC
  • Revision ID: will.newton@linaro.org-20130621144210-za4jb0kw9d4mcnml
Allow aligning source and destination buffers separately.

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 alignment elapsed rest')
 
6
Record = collections.namedtuple('Record', 'variant function bytes loops src_alignment dst_alignment elapsed rest')
7
7
 
8
8
 
9
9
def make_colours():
19
19
    except ValueError:
20
20
        return v
21
21
 
 
22
def create_column_tuple(record, names):
 
23
    cols = [getattr(record, name) for name in names]
 
24
    return tuple(cols)
22
25
 
23
26
def unique(records, name, prefer=''):
24
27
    """Return the unique values of a column in the records"""
25
 
    values = list(set(getattr(x, name) for x in records))
 
28
    if type(name) == tuple:
 
29
        values = list(set(create_column_tuple(x, name) for x in records))
 
30
    else:
 
31
        values = list(set(getattr(x, name) for x in records))
26
32
 
27
33
    if not values:
28
34
        return values
31
37
    else:
32
38
        return sorted(values)
33
39
 
 
40
def alignments_equal(alignments):
 
41
    for alignment in alignments:
 
42
        if alignment[0] != alignment[1]:
 
43
            return False
 
44
    return True
 
45
 
34
46
def parse_row(line):
35
47
    return Record(*[parse_value(y) for y in line.split(':')])
36
48