How to use the yappi.print_stats function in yappi

To help you get started, we’ve selected a few yappi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sumerc / yappi / tests / performance.py View on Github external
import yappi
import time

def foo():
    pass
    
def bar():
    for i in range(5000000):
        foo()

yappi.start()
t0 = time.time()
bar()
print "Elapsed1 %f secs." % (time.time()-t0)
yappi.print_stats()

t0 = time.time()
import cProfile
cProfile.run('bar()')
print "Elapsed1 %f secs." % (time.time()-t0)
github ioggstream / iposonic / __main__.py View on Github external
def signal_handler(signal_n, frame):
            print('You pressed Ctrl+C!')
            yappi.stop()
            yappi.print_stats(open("yappi.out", "w"))
            sys.exit(0)
        signal.signal(signal.SIGINT, signal_handler)
github ioggstream / iposonic / main.py View on Github external
def signal_handler(signal_n, frame):
            print('You pressed Ctrl+C!')
            yappi.stop()
            yappi.print_stats(open("yappi.out", "w"))
            sys.exit(0)
        signal.signal(signal.SIGINT, signal_handler)
github ilastik / lazyflow / benchmarks / latency.py View on Github external
r = features.outputs["Output"][:50,:50,:50,:]
    requests.append(r)

for r in requests:
    r.submit()

for r in requests:
    r.wait()
t2 = time.time()
print "\n\n"
print "LAZYFLOW ASYNC WAIT FEATURES:   %f seconds for %d iterations" % (t2-t1,mcountf)
print "                                %0.3fms latency" % ((t2-t1)*1e3/mcountf,)

if doProfile:
    yappi.stop()
    yappi.print_stats(sort_type = yappi.SORTTYPE_TTOT)




def empty_func(b):
    a = 7 + b
    a = "lksejhkl JSFLAJSSDFJH   AKDHAJKSDH ADKJADHK AJHSKA AKJ KAJSDH AKDAJHSKAJHD KASHDAKDJH".split(" ")

t1 = time.time()

def lots_of_work():
    requests = []
    for i in range(mcount):
        req = Request(functools.partial(empty_func, b = 11))
        req.submit()
github ourresearch / total-impact-core / extras / profiling / run_profiling.py View on Github external
logfile = '/tmp/total-impact.log'


yappi.clear_stats()
yappi.start()
backend.main(logfile)

### Now, in another window run
# ./services/api start
# ./services/proxy start
# ./extras/functional_test.py -i 6 -n 6
# then when it is done, in python do a Cntl C to stop the backend and return to python prompt

yappi.stop()

yappi.print_stats(sort_type=yappi.SORTTYPE_TTOT, limit=30, thread_stats_on=False)
github albertz / music-player / src / debug.py View on Github external
def __exit__(self,*args):
		import yappi
		yappi.stop()
		yappi.print_stats()
		yappi.clear_stats()