A simple context manager that measures time using perf_counter()
Project description
A Context Manager and A Decorator for Measuring Execution Time
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 details)
Built Distribution
File details
Details for the file cm_time-0.1.2.tar.gz
.
File metadata
- Download URL: cm_time-0.1.2.tar.gz
- Upload date:
- Size: 7.8 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.15 tqdm/4.65.0 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2848efc5868884d0a7795408ec9b2c21d2d3e2cf399241e8e4531a29128b638 |
|
MD5 | 8afd0e6fdd1e63b2f32a1f16f10854ef |
|
BLAKE2b-256 | fbdbaef662a01ec5b855f1fa1ca969f5cf6489a2e7c83f38704426bdf8c6c1d9 |
File details
Details for the file cm_time-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: cm_time-0.1.2-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.15 tqdm/4.65.0 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dfd172916a7b23f508fbca046157067ab9374fc38791d408278ce7288077cfa |
|
MD5 | 3155a0b88f4c302ace5fd7700120b8da |
|
BLAKE2b-256 | 535f28ac6460fc9c67d4751200fffe56006c465663f7a1672793c6d8482b21e5 |