Skip to main content

Timing class for measuring elapsed time and average elapsed time.

Project description

noiftimer

Simple timer class to track average elapsed time with optional sub-second precision.
Install with:

pip install noiftimer

Usage:

from noiftimer import Timer
import time

def very_complicated_function():
    time.sleep(1)

timer = Timer()
for _ in range(10):
    timer.start()
    very_complicated_function()
    timer.stop()
print(f'{timer.average_elapsed_time=}')
print(timer.get_stats(subsecond_resolution=True))

produces

timer.average_elapsed_time=1.0006019
elapsed time: 1s 836us
average elapsed time: 1s 601us

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

noiftimer-1.3.0.tar.gz (43.2 kB view hashes)

Uploaded Source

Built Distribution

noiftimer-1.3.0-py3-none-any.whl (4.2 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