Timing class for measuring elapsed time and average elapsed time.
Project description
noiftimer
Simple timer class to track elapsed time.
Install with:
pip install noiftimer
Usage:
>>> from noiftimer import Timer, time_it >>> import time
Timer object
>>> def very_complicated_function(): ... time.sleep(1) ... >>> timer = Timer() >>> for _ in range(10): ... timer.start() ... very_complicated_function() ... timer.stop() ... >>> print(timer.stats) elapsed time: 1s 1ms 173us average elapsed time: 1s 912us >>> timer.elapsed 1.001173496246338 >>> timer.elapsed_str '1s 1ms 173us' >>> timer.average_elapsed 1.0009121656417848 >>> timer.average_elapsed_str '1s 912us'
time_it decorator (executes the decorated function 10 times)
>>> @time_it(10) ... def very_complicated_function(): ... time.sleep(1) ... >>> very_complicated_function() very_complicated_function average execution time: 1s 469us
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
noiftimer-2.3.1.tar.gz
(57.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file noiftimer-2.3.1.tar.gz.
File metadata
- Download URL: noiftimer-2.3.1.tar.gz
- Upload date:
- Size: 57.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b39647e1eddf3e54a346da1aa48c43b4e84cdde85ebf37eab5f344bb95cd733
|
|
| MD5 |
e2769711b42fcc26289e544dda74a5f3
|
|
| BLAKE2b-256 |
f0c89a9fb7eabf4f9f14d3eafe6d015a629b22e3634a9457f7a48a961b3978df
|
File details
Details for the file noiftimer-2.3.1-py3-none-any.whl.
File metadata
- Download URL: noiftimer-2.3.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf39ab5d7e9842523290f4121987f270aa087e2ae5191992de767492f1968c80
|
|
| MD5 |
4f553a25defc210432b26b1282b3900e
|
|
| BLAKE2b-256 |
f5f0d6b70adf292fda205949614e52ffa9b8f0062bbfb289deaa8541898e0e62
|