Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def time_fibonacci(n):
atimer = timing.auto_timer('({})@{}'.format(n, timing.FILE(use_dirname=True)))
key = ('fibonacci(%i)' % n)
timer = timing.timer(key)
timer.start()
fibonacci(n)
timer.stop()
fibonacci(27)
del autotimer
self.assertEqual(tman.size(), 1)
tman.clear()
timing.toggle(False)
if True:
autotimer = timing.auto_timer("off")
fibonacci(27)
del autotimer
self.assertEqual(tman.size(), 0)
tman.clear()
timing.toggle(True)
if True:
autotimer_on = timing.auto_timer("on")
timing.toggle(False)
autotimer_off = timing.auto_timer("off")
fibonacci(27)
del autotimer_off
del autotimer_on
self.assertEqual(tman.size(), 1)
timing.util.opts.set_report(join(self.outdir, "timing_toggle.out"))
timing.util.opts.set_serial(join(self.outdir, "timing_toggle.json"))
tman.report()
def create_timer(n):
autotimer = timing.auto_timer('{}'.format(n))
fibonacci(30)
if n < 8:
create_timer(n + 1)
def func_1(n):
autotimer = tim.auto_timer('{}:{}'.format(tim.FILE(), tim.LINE()))
fibonacci(n)
func_mem(array_size)
def calcfib(nfib):
autotimer = tim.auto_timer()
t = tim.timer("> [pyc] fib({}) ".format(nfib))
t.start()
ret = fibonacci(nfib)
t.stop()
print ('fibonacci({}) = {}\n'.format(nfib, ret))
t.report()
return ret