Skip to main content

Wrapper script for easier use of the built-in profiler

Project description

Python3 - Profiler Wrapper

This package provides a wrapper function for easier usage of the built-in profiler.

It only uses builtin modules.

Install

python3 -m pip install profiler_wrapper

See: PyPI

Install

pip install profiler_wrapper

Usage

from profiler_wrapper import profile

def function_to_profile(switch: bool, data: dict, msg: str):
    ...
    return {'data': 'test'}


profile(
    target=function_to_profile,
    args=[True],
    kwargs={
        'data': {'random': 'test'},
        'msg': 'Yesterday is gone.'
    },
    lines=3,
)

# (
#   {'data': 'test'},
#
#   "270011472 function calls (270011215 primitive calls) in 181.830 seconds
#    Ordered by: internal time
#
#    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
#         1    5.000    5.000    8.000    8.000 /tmp/test.py:95(function_to_profile)
#         2    2.000    2.000    3.000    3.000 /tmp/test.py:89(sub_function)
#         3    1.000    1.000    1.000    1.000 /tmp/test.py:89(sub_function2)
#    "
# )

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

profile-wrapper-1.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

profile_wrapper-1.0.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file profile-wrapper-1.0.0.tar.gz.

File metadata

  • Download URL: profile-wrapper-1.0.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for profile-wrapper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9b898ae28c343754a1e2fc9dd7702e2aad8df0606e1d0f0720a05e008e659d35
MD5 c40f8ae092c5d116b4a6e4ce39b7e5a3
BLAKE2b-256 2158b24dd2581240e6f0dad708f03ce939fc0f41eba8660f16c43d97d20439c6

See more details on using hashes here.

File details

Details for the file profile_wrapper-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for profile_wrapper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f40839e5a3f20c797dce33f7fc692e3b998f33a37ea25336208ae302bfcbbbcd
MD5 4acad28537873250ff3846d2327b0439
BLAKE2b-256 d71f20092ced3d40f7f689d6270ceff4f4524eab0560f2b36b4c4af6faa5ee9f

See more details on using hashes here.

Supported by

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