Toolset for granular and live profiling
Project description
Pyrofiler
Toolset for granular memory and cpu live profiling
Quick start
Contextmanager that measures time of execution
# examples/simple_profile.py
import pyrofiler
import time
with pyrofiler.timing('Time elapsed'):
time.sleep(1)
$ python simple_profile.py
Time elapsed : 1.001563310623169
Decorators for profiling functions
# examples/simple_profile_cpu.py
import pyrofiler
@pyrofiler.cpu_util(description='Cpu usage')
@pyrofiler.timed('Time elapsed')
def sum_series(x, N):
return sum([x**i/i for i in range(1, N)])
sum_series(.3, 1000_000)
$ python simple_profile_cpu.py
Time elapsed : 0.13478374481201172
Cpu usage : 29.4
Aggregate the results in common context:
# examples/profile_with_context.py
from pyrofiler import Profiler
import time
prof = Profiler()
with prof.timing('Time 1'):
time.sleep(1)
with prof.timing('Time 2'):
time.sleep(1.5)
print('Profiling data recorded:')
print(prof.data)
$ python profile_with_context.py
Time 1 : 1.0011215209960938
Time 2 : 1.5020403861999512
Profiling data recorded:
{'Time 1': 1.0011215209960938, 'Time 2': 1.5020403861999512}
You can use other actions, for example appending results to some list in data. Check the documentation for more use cases
Similar products
… and lots of others
Problems
Either you have a cli tool that profiles memory and cpu, but no code api for granular data
or you have stuff like decorators and no memory profiling
Having a live dashboard would help also, use https://github.com/libvis for that
Features
TODO
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2020-03-04)
First release on PyPI.
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 pyrofiler-0.1.5.tar.gz.
File metadata
- Download URL: pyrofiler-0.1.5.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35671e192fc9452bc4082a3e06664759b8d8672a624c99a91e9d55a4120c7558
|
|
| MD5 |
80a8aacc89f01bbd1ac9b68266cfb2c4
|
|
| BLAKE2b-256 |
99bc808751507da45765ffefd3166662d8b579fb5065a9e70cfca5fe7b6b51e5
|
File details
Details for the file pyrofiler-0.1.5-py2.py3-none-any.whl.
File metadata
- Download URL: pyrofiler-0.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad110f94f0c559a47d97561c4964ca50e7a2f0037ddff351f487aae44bc40d96
|
|
| MD5 |
39c8f7151af25a8df79b064957c2ac18
|
|
| BLAKE2b-256 |
e8aa4f8296936716fa4005a447aac4a3db37f5ef6acb9077d9de272d4bbbef95
|