https://github.com/chill90/BoloCalc
Tip revision: c1d1830e3a4aebc26c0c66711daea174d43807da authored by Charles Hill on 10 December 2019, 20:08:29 UTC
Fixed bug with custom band handling
Fixed bug with custom band handling
Tip revision: c1d1830
profile.py
import sys as sy
import cProfile as cp
import io
import pstats as ps
# Profiler decorator
def profiler(func):
def inner(*args, **kwargs):
pr = cp.Profile()
pr.enable()
retval = func(*args, **kwargs)
pr.disable()
s = io.StringIO()
# sortby = 'cumulative'
sortby = 'tottime'
pstat = ps.Stats(pr, stream=s).sort_stats(sortby)
pstat.print_stats()
sy.stdout.write(s.getvalue())
return retval
return inner