Skip to main content

A simple context manager timing utility.

Project description

Measures the execution time of a block of code. Uses perf_counter for the measurement. Behaves like a float (seconds) when printed or used within an arithmetic context.

Example

from cmtimer import Timer

with Timer() as time:
    # Three hours too soon or a minute too late?

print(f"Time taken: {time:.2f} s")

Installation

pip3 install cmtimer

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 cmtimer, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size cmtimer-0.0.1.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page