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

profiler_wrapper-1.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file profiler_wrapper-1.0.0.tar.gz.

File metadata

  • Download URL: profiler_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 profiler_wrapper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 105d5211cbf32d9a7d904b5d4e597cb69cdb4dcf2df5a2ece3f1bface8c71495
MD5 f94373676d55e79d796779bdb94ba5d8
BLAKE2b-256 dce2663c3f94a1677fec0dc5e6fdd4e785783921b038ca06b00d4dd8bef80e43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for profiler_wrapper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35f6122a1644eae23482cdcabf749051391aa645ddd6c003ed35b152936b234c
MD5 b47389c4fbf5518e2d3b5ba4c0bba98b
BLAKE2b-256 0b9d867446d418588cc2675f0bd713c9b794411fd37ae4f0daca709711e93e6d

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