How to use the timemory.FILE 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 / cmake / Templates / __init__.py View on Github external
def __call__(self, func):

        import timemory as tim
        file = tim.FILE(3)
        line = tim.LINE(2)

        @wraps(func)
        def function_wrapper(*args, **kwargs):

            # add_args only if key not specified
            if self.add_args and self.key == "":
                self.key = self.arg_string(args, kwargs)

            t = tim.timer_decorator(func.__name__, file, line,
                self.key, self.add_args)

            return func(*args, **kwargs)

        return function_wrapper
github NERSC / timemory / examples / nested.py View on Github external
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 ('')
github NERSC / timemory / examples / nested.py View on Github external
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 ('')