Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

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.


from cmtimer import Timer

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

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


pip3 install cmtimer

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
cmtimer-0.0.1.tar.gz (2.1 kB) Copy SHA256 hash SHA256 Source None Jul 14, 2016

Supported by

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