Skip to content
/ pprof Public

Python Decorator for Profiling Function or Method

License

Notifications You must be signed in to change notification settings

nsiregar/pprof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Python Decorator for Profiling Function or Method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages