Python time.h() Examples

The following are code examples for showing how to use time.h(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: chat   Author: Decalogue   File:    (license) View Source Project 5 votes vote down vote up
def time_me(info="used", format_string="ms"):
    """Performance analysis - time

    Decorator of time performance analysis.
    ????(wall clock time, elapsed time)???????????????????????

        info: Customize print info. ????????
        format_string: Specifies the timing unit. ?????????'s': ??'ms': ???
            Defaults to 's'.
    def _time_me(func):
        def _wrapper(*args, **kwargs):
            start = time.clock()
            # start = time.perf_counter()
            # start = time.process_time()
            result = func(*args, **kwargs)
            end = time.clock()
            if format_string == "s":
                print("%s %s %s"%(func.__name__, info, end - start), "s")
            elif format_string == "ms":
                print("%s %s %s" % (func.__name__, info, 1000*(end - start)), "ms")
            return result
        return _wrapper
    return _time_me 
Example 2
Project: Theano-Deep-learning   Author: GeekLiB   File:    (license) View Source Project 5 votes vote down vote up
def c_headers(self):
        # std.cout doesn't require the '%' symbol to print stuff...
        # so it works much better with python's string-substitution stuff.
        return ['<iostream>', '<time.h>', '<sys/time.h>']