<reponame>pradeep-p-1999/automated-trading-and-alert-system-<filename>performance.py
import cProfile,pstats,io

def profile(fnc):
    def inner(*args,**kwargs):
        pr=cProfile.Profile()
        pr.enable()
        retval=fnc(*args,**kwargs)
        pr.disable()
        s=io.StringIO()
        sortby='cumulative'
        ps=pstats.Stats(pr,stream=s).sort_stats(sortby)
        ps.print_stats()
        print(s.getvalue())
        return retval
    return inner

import cProfile,pstats,io

def profile(fnc):
    def inner(*args,**kwargs):
        pr=cProfile.Profile()
        pr.enable()
        retval=fnc(*args,**kwargs)
        pr.disable()
        s=io.StringIO()
        sortby='cumulative'
        ps=pstats.Stats(pr,stream=s).sort_stats(sortby)
        ps.print_stats()
        print(s.getvalue())
        return retval
    return inner