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 pprofiler 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.1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

pprofiler-0.1.1-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

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