view common/time.py @ 355:430c9e92cd23

Added common directory
author Joseph Turian <turian@iro.umontreal.ca>
date Thu, 19 Jun 2008 16:12:29 -0400
parents
children
line wrap: on
line source


import time
#http://www.daniweb.com/code/snippet368.html
def print_timing(func):
    def wrapper(*arg):
        t1 = time.time()
        res = func(*arg)
        t2 = time.time()
        print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0)
        return res
    return wrapper