Skip to main content

Python Decorator for Profiling Function or Method

Project description

pprofiler

Simple Python Decorator to Profiling Function or Method

Installation

Use the package manager pip to install pprof.

pip install pprof

Usage

# profiling.py

from pprof import pprof

@pprof()
def method_to_profile():
    # do some task
    print("value")

method_to_profile()

it will resulting cProfile output on console

$ python ./profiling.py
value
         3 function calls in 0.000 seconds

   Ordered by: call count

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.000    0.000 {built-in method builtins.print}
        1    0.000    0.000    0.000    0.000 <ipython-input-8-fb2a62e7b3fa>:1(test)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}

License

MIT

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

pprofiler-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

pprofiler-0.1.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file pprofiler-0.1.0.tar.gz.

File metadata

  • Download URL: pprofiler-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.11.0-44-generic

File hashes

Hashes for pprofiler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7d31e71194a92103ad2d43496dd0d5483de0d65e9ccacc576995b08ac777b357
MD5 f71b0460ef1e202e9ee75e7b58bec1a0
BLAKE2b-256 04c5acf9cfbde71150de59d6f33c4d591e159370af25722cdc5e890cc1061b40

See more details on using hashes here.

File details

Details for the file pprofiler-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pprofiler-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.11.0-44-generic

File hashes

Hashes for pprofiler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79b9e2b7761d017e3b2d3d16fd34697ed6cfc3a324b7361c7822bd311188a8ae
MD5 56bd742d85b49a19643ea74755b9a139
BLAKE2b-256 43571413b3318da105f8f428dbd9593d35493ad0c52e685edfc21f5d245ff204

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