Conveniently get a rough idea of how long things take.
Project description
magic-timer
pip install magic-timer
Conveniently get a rough idea of how long things take.
Use via decorator:
from magic_timer import MagicTimer, magic_timer
import time
@magic_timer
def some_slow_function():
time.sleep(3)
some_slow_function()
> magic-timer: 'some_slow_function' - 0:00:00:03:000
Use via MagicTimer object:
def some_slow_function():
time.sleep(2)
timer = MagicTimer()
some_slow_function()
print(timer)
> 0:00:00:02:000
Output is in: days:hours:minutes:seconds:milliseconds
See also this notebook.
This package is tiny. It uses time.time() to measure time. For greater precision & accuracy, you could use something like timeit.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
magic-timer-0.0.7.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for magic_timer-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84deb14724dda66541ae93747c875046d8a11e3787a8ce85a8701ad3b9882ffd |
|
MD5 | e1846808b619b09e4a784367ba3158ef |
|
BLAKE2b-256 | 96e053f72b00e6158469e30dda330bf36d0be4187fd53cb1d80b5e86f150abcf |