diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-30 20:04:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-30 20:04:11 +0100 |
| commit | b4ff18156c52e65404459966ff4e551604e235c3 (patch) | |
| tree | 1e764e6886c6b7eae6029d5a8871640d1edf0cc3 /optimise/plotlog | |
| parent | 260747962d87ed12115e940f7a9e86fcf7983ea4 (diff) | |
Move some stuff around.
Diffstat (limited to 'optimise/plotlog')
| -rwxr-xr-x | optimise/plotlog | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/optimise/plotlog b/optimise/plotlog deleted file mode 100755 index 55b6fb871..000000000 --- a/optimise/plotlog +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/python - -from pylab import * -import sys - -class Point: - def __init__(self, t, a): - self.time = t - self.awake = a - -decoder = [] -writer = [] -encoder = dict() - -f = open(sys.argv[1], 'r') -for l in f.readlines(): - l = l.strip() - s = l.split() - if len(s) == 0: - continue - - t = s[0].split(':') - if len(t) != 2: - continue - - secs = float(t[0]) + float(t[1]) / 1e6 - if s[1] == 'decoder' and s[2] == 'sleeps': - decoder.append(Point(secs, False)) - elif s[1] == 'decoder' and s[2] == 'wakes': - decoder.append(Point(secs, True)) - elif s[1] == 'encoder' and s[2] == 'thread' and s[4] == 'finishes': - if s[3] not in encoder: - print 'new encoder %s' % s[3] - encoder[s[3]] = [] - encoder[str(s[3])].append(Point(secs, False)) - elif s[1] == 'encoder' and s[2] == 'thread' and s[4] == 'begins': - if s[3] not in encoder: - print 'new encoder %s' % s[3] - encoder[s[3]] = [] - encoder[s[3]].append(Point(secs, True)) - elif s[1] == 'writer' and s[2] == 'sleeps': - writer.append(Point(secs, False)) - elif s[1] == 'writer' and s[2] == 'wakes': - writer.append(Point(secs, True)) - -def do_a_plot(points, tit, pos): - x = [] - y = [] - awake = False - for p in points: - if p.awake != awake: - x.append(p.time) - y.append(int(awake) + pos) - x.append(p.time) - y.append(int(p.awake) + pos) - awake = p.awake - - plot(x, y) -# fill_between(x, y, 0, color='0.8') - title(tit) - -figure() - -N = len(encoder) + 2 - -do_a_plot(decoder, 'dec', 0) -do_a_plot(writer, 'wri', 1) - -encoder_list = [] -for k, v in encoder.iteritems(): - encoder_list.append(v) - -print len(encoder_list) - -y = 2 -for e in encoder_list: - do_a_plot(e, 'enc', y) - y += 1 - -show() |
