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.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

cm_time-0.1.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file cm_time-0.1.1.tar.gz.

File metadata

  • Download URL: cm_time-0.1.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.10

File hashes

Hashes for cm_time-0.1.1.tar.gz
Algorithm Hash digest
SHA256 11e1935ef7a48a8303c490e84f1ced4450fc379e2681150fd08a2bee9ba0ab41
MD5 fe064eeca24022d99c6a6a5be9c45f29
BLAKE2b-256 d66f8fd021e1b5e1fbdc012fc3878c8d067249c1f26b3d9719a4e98d66abf711

See more details on using hashes here.

File details

Details for the file cm_time-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cm_time-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.10

File hashes

Hashes for cm_time-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b76c2280ccdc85aeb12f33d7faa9508cc3cc751954c43d7033e1f3dcd8325811
MD5 9c8570b9881beb002a46acaa80cd2f14
BLAKE2b-256 6748e751d79848d6ae49a2163a1fd35938c6945dcf8b82a06bad0ae7aa9a8927

See more details on using hashes here.

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