diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-01-11 21:30:50 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-01-11 21:30:50 +0000 |
| commit | 0d7cb9548dffbbb64c0bc807eaa1f75159760b96 (patch) | |
| tree | 4e2c836aefb27c1b17dd6ab97a4ba24a6d8c25a6 /analog | |
| parent | 9cec72e1d8a6ef5b4fdb656a9b7713ea750548e3 (diff) | |
Move optimisation stuff around a bit.
Diffstat (limited to 'analog')
| -rwxr-xr-x | analog | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/analog b/analog deleted file mode 100755 index 174300810..000000000 --- a/analog +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/python - -import sys - -class Encoder: - def __init__(self): - self.awake = 0 - self.asleep = 0 - self.last_event = 0 - self.state = None - -encoders = dict() - -f = open(sys.argv[1], 'r') -while 1: - l = f.readline() - if l == '': - break - - 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] == 'encoder' and s[2] == 'thread' and s[4] == 'finishes': - tid = s[3] - if not tid in encoders: - encoders[tid] = Encoder() - - assert(encoders[tid].state == None or encoders[tid].state == 'awake') - if encoders[tid].state == 'awake': - encoders[tid].awake += (secs - encoders[tid].last_event) - - encoders[tid].state = 'asleep' - encoders[tid].last_event = secs - - elif s[1] == 'encoder' and s[2] == 'thread' and s[4] == 'begins': - tid = s[3] - if not tid in encoders: - encoders[tid] = Encoder() - - if encoders[tid].state is not None: - encoders[tid].asleep += (secs - encoders[tid].last_event) - - encoders[tid].state = 'awake' - encoders[tid].last_event = secs - -for k, v in encoders.iteritems(): - print '%s: awake %f asleep %f' % (k, v.awake, v.asleep) |
