Timer#
- class dpeeg.tools.Timer(name: str = 'dpeeg_timer')[source]#
Timing the running time of the program.
Examples
If you want to start a default timer and then calculate the program interval, you can do like:
>>> timer = Timer() >>> do_something() >>> h, m, s = timer.stop() >>> h, m, s 1, 2, 13.435
And you can update the start time of the default timer, just do like:
>>> timer.start()
You can also register a specified timer and update the start time of it.
>>> timer.start('new') >>> h, m, s = timer.stop('new')
- start(name: str = 'dpeeg_timer') str[source]#
Update specified timer or register a timer if it does not exist.
- stop(name: str = 'dpeeg_timer', restart: bool = False) tuple[int, int, float][source]#
Get the hours, minutes, and seconds of a specific timer.