https://github.com/chill90/BoloCalc
Tip revision: 46219833d0084e9f50f596ace9b4373ebeb1a89b authored by Charles Hill on 17 June 2020, 17:44:13 UTC
Fixed bug when handling large absorptivities
Fixed bug when handling large absorptivities
Tip revision: 4621983
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