How to use the timemory.auto_timer function in timemory

To help you get started, we’ve selected a few timemory 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 NERSC / timemory / python / unit_testing.py View on Github external
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()
github NERSC / timemory / python / unit_testing.py View on Github external
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()
github NERSC / timemory / python / unit_testing.py View on Github external
def create_timer(n):
            autotimer = timing.auto_timer('{}'.format(n))
            fibonacci(30)
            if n < 8:
                create_timer(n + 1)
github NERSC / timemory / examples / nested.py View on Github external
def func_1(n):
    autotimer = tim.auto_timer('{}:{}'.format(tim.FILE(), tim.LINE()))
    fibonacci(n)
    func_mem(array_size)
github NERSC / timemory / examples / simple.py View on Github external
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