How to use the timemory.timing_manager 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 get_pointer_max():
            return timing.timing_manager().get_max_depth()
github NERSC / timemory / python / unit_testing.py View on Github external
def set_pointer_max(nmax):
            tman = timing.timing_manager()
            tman.set_max_depth(4)
            return tman.get_max_depth()
github NERSC / timemory / python / unit_testing.py View on Github external
def test_timing(self):
        print ('Testing function: "{}"...'.format(timing.FUNC()))

        timing.util.opts.set_report(join(self.outdir, "timing_report.out"))
        timing.util.opts.set_serial(join(self.outdir, "timing_report.json"))

        tman = timing.timing_manager()

        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()


        tman.clear()
        t = timing.timer("tmanager_test")
        t.start()

        for i in [39, 35, 43, 39]:
            # python is too slow with these values that run in a couple
github NERSC / timemory / examples / simple.py View on Github external
def main(nfib):
    print ('')
    print ('main: file() {}'.format(tim.FILE()))
    print ('main: line() {}'.format(tim.LINE()))
    print ('main: line() {}'.format(tim.LINE()))
    print ('main: func() {}'.format(tim.FUNC()))
    test()
    print ('')
    tman = tim.timing_manager()
    calcfib(int(nfib))
    tman.report()
    tman.serialize('output.json')
    print ('')
    tim.plot.plot(["output.json"], display=False)
github NERSC / timemory / examples / nested.py View on Github external
parser.add_argument("-n", "--nfib",
                        help="Number of fibonacci calculations",
                        default=15, type=int)
    parser.add_argument("-s", "--size",
                        help="Size of array allocations",
                        default=array_size, type=int)
    args = tim.util.add_arguments_and_parse(parser)
    array_size = args.size

    print ('')
    try:
        t = tim.timer("Total time")
        t.start()
        main(args.nfib)
        print ('')
        tman = tim.timing_manager()
        tman.report()
        tman.serialize('output.json')
        print ('')
        _data = tim.util.read(tman.json())
        _data.title = tim.FILE(noquotes=True)
        _data.filename = tim.FILE(noquotes=True)
        tim.util.plot(data = [_data], files = ["output.json"], display=False)
        t.stop()
        print ('')
        t.report()
    except Exception as e:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        traceback.print_exception(exc_type, exc_value, exc_traceback, limit=5)
        print ('Exception - {}'.format(e))

    print ('')