Staging
v0.5.0
v0.5.0
https://foss.heptapod.net/mercurial/hgview
Tip revision: b71e0bab8c2f62e9c1a7e297e0c72f95e773f7ed authored by David Douard on 05 June 2009, 11:41:34 UTC
close new_qt_ui branche (it's now teh default branch)
close new_qt_ui branche (it's now teh default branch)
Tip revision: b71e0ba
decorators.py
# -*- coding: utf-8 -*-
import time
def timeit(f):
"""Decorator used to time the execution of a function"""
def timefunc(*args, **kwargs):
"""wrapper"""
t1 = time.time()
t2 = time.clock()
res = f(*args, **kwargs)
t3 = time.clock()
t4 = time.time()
print "%s: %.2fms (time) %.2fms (clock)" % (f.func_name, 1000*(t3 - t2), 1000*(t4 - t1))
return res
return timefunc