Simple profiling decorator
Project description
A simple profiling decorator:
In [1]: from profiled import profiled, Profiler
In [2]: @profiled
...: def get_answer():
...: return 42
...:
In [3]: profiler = Profiler()
In [4]: with profiler:
...: for i in range(100000): get_answer()
...:
In [5]: profiler.compute_stats()
Out[5]:
{'get_answer': {'avg': 2.2763967514038087e-07,
'max': 0.00016736984252929688,
'min': 0.0,
'num': 100000,
'std': 6.953436521202228e-07,
'tot': 0.022763967514038086}}
The decorator also works with class methods. That’s about it.
Install with pip install profiled.
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
profiled-2.0.0.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file profiled-2.0.0.tar.gz
.
File metadata
- Download URL: profiled-2.0.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-39-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bedc516d5f549ea5a8fd2b92287014952b8d6ea38fdf380ab0f0359558efe1c |
|
MD5 | 80849d39989b7b89d436dda39e9cb736 |
|
BLAKE2b-256 | 77bc07a086c761bbdb70e0f1ffa17db27586c5b81006d2eadc6d4f4169664812 |
File details
Details for the file profiled-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: profiled-2.0.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-39-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8a2c59005c00e65bcc1607b0c06549812f42d7e518f470b4a57fd7e9541b4a2 |
|
MD5 | 013baf46e9af67ee81829f40b50553da |
|
BLAKE2b-256 | d1c1f75418cddcd9913addb625859190cc061011ef3ba58a5f84a1e8a6d6d6e4 |