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 pprofiler.

pip install pprofiler

Usage

Python 3.8.10 (default, Jun 23 2021, 11:56:21)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.24.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pprofiler import pprof

In [2]: @pprof(sort_by=["cumulative", "ncalls"])
   ...: def test():
   ...:     arr = []
   ...:     for i in range(0, 100_000):
   ...:         arr.append(i)
   ...:

In [3]: test()
         100002 function calls in 0.018 seconds

   Ordered by: cumulative time, call count

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.012    0.012    0.018    0.018 <ipython-input-4-87325251511f>:1(test)
   100000    0.005    0.000    0.005    0.000 {method 'append' of 'list' objects}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}

pprofiler 0.1.2 Release Notes

January 12, 2022

Changelog

  • Add line_to_print parameter - to reduce output for large profiler output
  • Add strip_dirs parameter - to reduce output for large profiler output
  • sort_by parameter now accept tuple or list

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

Uploaded Source

Built Distribution

pprofiler-0.1.2-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pprofiler-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1396545a2e831d445ed9fd47a143c3ce89f9b4334575e601f3e134b7928e745e
MD5 81d3145faffb0e068f2815f5de9bc906
BLAKE2b-256 922707fbb62d4c2ce9e39b6064b7f567363975d2fad1bd8a467134d966c9832a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pprofiler-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69c14879705f017ae2f95ad47ec4daffd98a66fa86915a96fa01abd63754d3e4
MD5 b999d26d19ca80a6828a5822d4aabdb1
BLAKE2b-256 703e210651c0a8dc346f6eb94cff2445826b8f7abcea11f9d3b264499f4a2f01

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