Skip to main content

Toolset for granular and live profiling

Project description

Pyrofiler

https://img.shields.io/pypi/v/pyrofiler.svg https://img.shields.io/travis/DaniloZZZ/pyrofiler.svg Documentation Status

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrofiler-0.1.4.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrofiler-0.1.4-py2.py3-none-any.whl (6.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyrofiler-0.1.4.tar.gz.

File metadata

  • Download URL: pyrofiler-0.1.4.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for pyrofiler-0.1.4.tar.gz
Algorithm Hash digest
SHA256 06a8323dcf12441481cccaed811eaf4f14e3ed90984e8426acda2accca4a63db
MD5 8f6abdc91c834fc2f9d1dcc3d9db2ca6
BLAKE2b-256 f40104dbc3ab44e19023c517238eb50419a1d3d4f5363a8662c8c72dcbb994d2

See more details on using hashes here.

File details

Details for the file pyrofiler-0.1.4-py2.py3-none-any.whl.

File metadata

  • Download URL: pyrofiler-0.1.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.5 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/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for pyrofiler-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9a9fc2a69bfe7ba7c028ebfccfd7f0c7b51e7eb111f629b6f0f2f37bf28bb8ee
MD5 c618f761139ef8f38fb4320b6f50793b
BLAKE2b-256 32b28853861bcb6d1b461e7905118df7fc9e6502c91f24795f736e087b8dde2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page