Timer
Timer
¶
A simple class which can be used to time events.
Source code in ckantools/timer.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
__init__()
¶
The timer is started upon instantiation (i.e. when this function is called).
Source code in ckantools/timer.py
13 14 15 16 17 18 | |
add_event(label)
¶
Add a new event at the current time with the given label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
the label for the event |
required |
Source code in ckantools/timer.py
20 21 22 23 24 25 26 | |
to_dict()
¶
Return an OrderedDict of timings. Each key in the returned OrderedDict is a label and the value associated with it is the number of seconds it took between the previous event and this one.
Returns:
| Type | Description |
|---|---|
|
an OrderedDict of events and how long they took |
Source code in ckantools/timer.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |