Skip to main content

Conveniently get a rough idea of how long things take.

Project description

magic-timer

pip install magic-timer

A simple 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(2.75)

some_slow_function()
> 'some_slow_function' - 2.8 seconds

Use via MagicTimer object:

def some_slow_function():
    time.sleep(90/1000)

timer = MagicTimer()

some_slow_function()

print(timer)
> 94 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.

Files for magic-timer, version 0.0.9
Filename, size File type Python version Upload date Hashes
Filename, size magic_timer-0.0.9-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size magic-timer-0.0.9.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page