1 from datetime
import datetime
5 def __init__(self
, start
=True):
10 self
.start
= datetime
.now()
12 self
.last_tick
= self
.start
15 self
.end
= datetime
.now()
16 print ' Total time: %s' % (self
.end
- self
.start
)
18 def tick(self
, msg
=''):
20 duration
= now
-self
.last_tick
21 print ' %s : %s' % (msg
, duration
)
23 self
.ticks
.append(duration
.seconds
+ duration
.microseconds
/1000000.0)
26 class Counter(object):
27 """ simpler counter class """
32 def __iadd__(self
, other
):
36 return str(self
.value
)