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.as_default():
...: 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-1.0.0.tar.gz
(3.1 kB
view details)
File details
Details for the file profiled-1.0.0.tar.gz.
File metadata
- Download URL: profiled-1.0.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a87bd6f2c5982aa3c5d7c931bfef30fae835447a1047e5e293b0d7070d368700
|
|
| MD5 |
0931527e6363794ba0c0a608e51e5f02
|
|
| BLAKE2b-256 |
1d43c6aeceb49a423b38821249b5468355c73aa03f9d33d532adee8e82eca991
|