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

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.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

profiler_wrapper-1.0.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: profiler_wrapper-1.0.1.tar.gz
  • Upload date:
  • Size: 13.8 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.1.tar.gz
Algorithm Hash digest
SHA256 8904818e8e3abb46138b4cc079f73737640a208d924e52a0749810a0e34a0742
MD5 77833d52c9e4029ab6f7db75b33885ae
BLAKE2b-256 6e8d9c19bfd059db248727b82f1d5c7a04f2f4f24d9baa22f4cf9717615957e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for profiler_wrapper-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f7431f56ba512ce5f37272a2c652db2c5a6b23758de2111f04f1b821447e2e6
MD5 ba05c15d076086feb245c71137305e0e
BLAKE2b-256 509e18aa5383f0cc45034d90d34b9d61a5dae56ffbb3a07aa453543086673bcc

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