Skip to main content

A simple context manager that measures time using perf_counter()

Project description

A Context Manager and A Decorator for Measuring Execution Time

CI Status Documentation Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License

A simple context manager that measures time using perf_counter()

Installation

Install this via pip (or your favourite package manager):

pip install cm-time

Usage

from cm_time import timer

with timer() as t:
      pass

print(t.elapsed)

Output:

Elapsed time: 0.000
0.0
from cm_time import timer_wrapped

@timer_wrapped()
def foo():
    pass

Output:

foo: Elapsed time: 0.000

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.

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

cm_time-0.1.2.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

cm_time-0.1.2-py3-none-any.whl (7.8 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