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.

Source Distribution

magic-timer-0.0.9.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

magic_timer-0.0.9-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page