Пример #1
0
def exit_action(errcode):
    man = timemory.manager()
    timemory.report(ign_cutoff=True)
    fname = 'signal_error_{}.out'.format(errcode)
    f = open(fname, 'w')
    f.write('{}\n'.format(man))
    f.close()
Пример #2
0
def exit_action(errcode):
    man = timemory.manager()
    timemory.report(ign_cutoff=True)
    fname = 'signal_error_{}.out'.format(errcode)
    f = open(fname, 'w')
    f.write('{}\n'.format(man))
    f.close()
Пример #3
0
def main(nfib):
    timemory.set_max_depth(10)
    print('')
    print('main: file() {}'.format(timemory.FILE()))
    print('main: line() {}'.format(timemory.LINE()))
    print('main: line() {}'.format(timemory.LINE()))
    print('main: func() {}'.format(timemory.FUNC()))
    test()
    print('creating manager...')
    tman = timemory.manager()
    print('creating Fibonacci object...')
    fib = Fibonacci(int(nfib))
    print('calculating fibonacci...')
    ret = fib.calculate()
    print('completed...')

    timemory.report()
Пример #4
0
            comp.stop()

        report = "{}".format(comp).replace("> [pyc] <module>@[]", "",
                                           1).replace(" [laps: 1]", "", 1)
        report = report.replace(": ", "", 1)
        suffix_report = report.split(",")

        strings = ["\n> {} total execution time :".format(exe_name)]
        for comp in suffix_report:
            strings.append("    {}".format(comp))

        for s in strings:
            print("{}".format(s))

        # generate report
        timemory.report()

        #----------------------------------------------------------------------#
        #   handler
        #
        if args.enable_handler:

            try:
                import timemory_json_handler
                timemory_json_handler.receive(sys.argv[1:],
                                              timemory_manager.json())

            except Exception as e:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                traceback.print_exception(exc_type, exc_value, exc_traceback)