A lightweight Python library to measure function execution time.
Project description
clockitpy �
A small Python library to measure function execution time easily.
Installation
pip install clockitpy
Usage
Using as a decorator
from clockitpy import measure_time
@measure_time
def my_function():
# Your code here
sum([i for i in range(1000000)])
my_function()
# Output: my_function executed in 0.045123 seconds
Using timeit function
from clockitpy import timeit
def my_function():
return sum([i for i in range(1000000)])
duration, result = timeit(my_function)
print(f"Execution time: {duration:.6f} seconds")
print(f"Result: {result}")
Features
- measure_time: A decorator to automatically measure and print execution time
- timeit: A function to measure execution time and get both duration and result
Requirements
- Python >= 3.7
License
MIT License - see LICENSE file for details
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
clockitpy-0.1.0.tar.gz
(2.8 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 clockitpy-0.1.0.tar.gz.
File metadata
- Download URL: clockitpy-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a57e7712ad016eebb69420a2fc472e3967f1f75af1ead4384d1c9dca8106545
|
|
| MD5 |
33c4d3936cf323c7b0f07611415d6741
|
|
| BLAKE2b-256 |
17d96fe1970d701264296f8099595c1f410d48931989801c668762a8e8775bd6
|
File details
Details for the file clockitpy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: clockitpy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0945256e49928af3803f8105f863b1c6878e2c15e5e1fd3baa2b3dfbb3d4a94d
|
|
| MD5 |
40d8992f29e7bab330bcef1b2c258694
|
|
| BLAKE2b-256 |
d9f35292d1b1a109dd81a9869cb471bf359942096d07089aa2f54ffe0f76f09d
|