https://github.com/chill90/BoloCalc
Raw File
Tip revision: 4e931186c72378284981e8a0d3fdb83709c5a847 authored by Charles Hill on 25 November 2019, 19:37:16 UTC
Fixed handling of FBW for very asymmetric bands
Tip revision: 4e93118
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
back to top