4 def _time_b(active
= True, name
= None, step
= None):
6 Auxiliary function for keeping track of elapsed time.
7 Returns current time (to be used by _time_e).
12 name
= sys
._getframe
(1).f_code
.co_name
14 print('%.4f: %s in function %s started.' % (now
, step
, name
), file = sys
.stderr
)
16 print('%.4f: Function %s started.' % (now
, name
), file=sys
.stderr
)
20 def _time_e(start_time
, active
= True, name
= None, step
= None):
24 name
= sys
._getframe
(1).f_code
.co_name
26 print('%.4f: %s in function %s finished (elapsed %.2f s).'
27 % (now
, step
, name
, now
- start_time
), file = sys
.stderr
)
29 print('%.4f: Function %s finished (elapsed %.2f s).'
30 % (now
, name
, now
- start_time
), file = sys
.stderr
)