7 def __init__(self, t, a):
15 f = open(sys.argv[1], 'r')
16 for l in f.readlines():
26 secs = float(t[0]) + float(t[1]) / 1e6
27 if s[1] == 'decoder' and s[2] == 'sleeps':
28 decoder.append(Point(secs, False))
29 elif s[1] == 'decoder' and s[2] == 'wakes':
30 decoder.append(Point(secs, True))
31 elif s[1] == 'encoder' and s[2] == 'thread' and s[4] == 'finishes':
32 if s[3] not in encoder:
33 print 'new encoder %s' % s[3]
35 encoder[str(s[3])].append(Point(secs, False))
36 elif s[1] == 'encoder' and s[2] == 'thread' and s[4] == 'begins':
37 if s[3] not in encoder:
38 print 'new encoder %s' % s[3]
40 encoder[s[3]].append(Point(secs, True))
41 elif s[1] == 'writer' and s[2] == 'sleeps':
42 writer.append(Point(secs, False))
43 elif s[1] == 'writer' and s[2] == 'wakes':
44 writer.append(Point(secs, True))
46 def do_a_plot(points, tit, pos):
53 y.append(int(awake) + pos)
55 y.append(int(p.awake) + pos)
59 # fill_between(x, y, 0, color='0.8')
66 do_a_plot(decoder, 'dec', 0)
67 do_a_plot(writer, 'wri', 1)
70 for k, v in encoder.iteritems():
71 encoder_list.append(v)
73 print len(encoder_list)
76 for e in encoder_list:
77 do_a_plot(e, 'enc', y)