TimeGuardian is a package for execution time measurement
Project description
TimeGuardian
TimeGuardian is a Python package designed for measuring and logging the execution time of functions. This package is especially useful for performance monitoring and optimization in Python applications.
Features
- Easy-to-use decorators for timing functions.
- Integrated logging with rich formatting.
- Conditional logging based on execution time.
Installation
You can install TimeGuardian directly from pip:
pip install timeguardian
Alternatively, if you have downloaded the source code, you can install it using:
cd path/to/TimeGuardian
pip install timeguardian
Usage
Import TimeGuardian
from the timeguardian
package and use it as a decorator on your functions to measure their execution time.
Basic Usage
from timeguardian import TimeGuardian
@TimeGuardian.measure
def my_function():
# function implementation
Terminal output:
Advanced Usage
You can also provide a custom name for logging the execution time:
from timeguardian import TimeGuardian
@TimeGuardian.measure(name="CustomFunctionName")
def another_function():
# function implementation
Additionally, you can set a time limit for logging. Execution times will only be logged if they exceed this limit:
from timeguardian import TimeGuardian
@TimeGuardian.measure(logTimeLimit=200)
def limited_function():
# function implementation
Terminal output:
Contributing
Contributions to TimeGuardian are welcome!
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
File details
Details for the file timeguardian-0.0.2.tar.gz
.
File metadata
- Download URL: timeguardian-0.0.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c72f4aa4e0d454614a488c0a67766885b57baa8625b22a6257fbaa0938ecc92 |
|
MD5 | 7796de57cf771f69b9716d65b0098f67 |
|
BLAKE2b-256 | 45b6c59ff1372e5a3bc02e942c0438bd0cc7c20249eb8c057d5b308bf03a0c23 |
File details
Details for the file timeguardian-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: timeguardian-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82cbdb5c84fd80e52690393a5c335b143cd260ca18fb9fed4dcd06e8fe463b3b |
|
MD5 | 8062db75f0efe26e5e3655f6f1dd4d2b |
|
BLAKE2b-256 | 229b278777cecadd0e39caa1f0790733426d7e05b452e80a7e9c761192aaa98b |