Vanilla python clock implementation for easy measurement of functions and with blocks.
Project description
Simple Clock (sclock)
Easy to use clock class, written in vanilla python. Allows to benchmark python code withing a function or with block. Contains multiple time banks for benchmarking different functions or with blocks independently.
Examples
Measuring code in a function as a decorator:
from sclock import Clock
clock = Clock()
@clock("custom_label")
def example_function():
time.sleep(1)
example_function()
print(clock.get_times("custom_label"))
print(clock.mean_time("custom_label"))
Measuring code in a with block:
from sclock import Clock
clock = Clock()
with clock.using_label("with_code"):
time.sleep(2)
print(clock.get_times("with_code"))
print(clock.mean_time("with_code"))
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
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 sclock-0.1.0.tar.gz.
File metadata
- Download URL: sclock-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6257ff7c371d941f8d48719b90b31d4c1bf0d40485ec1b2b7f050dfb30763cc1
|
|
| MD5 |
75c7eca1251b595dd21b83023e3adcd0
|
|
| BLAKE2b-256 |
da157bf23866b2e293204ea2a5ab8d9fede47f3270dc0093543ef4f4137911a3
|
File details
Details for the file sclock-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sclock-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e77835b160235da816771291b13f1587b459480ccc296179adc854f6b04938f4
|
|
| MD5 |
59ad73e626aefbe21b5dc83816ff7768
|
|
| BLAKE2b-256 |
77ac4244b711042aba0b97176747c91c15f077d411da1c99a9fa1be099cfcc2e
|