Staging
v0.8.1
v0.8.1
swh:1:snp:94aae2785f73ccaec5983b9f5ce071eed323eccf
Tip revision: 17c76bf1421d114524880f267e7a76222fa3dccc authored by Alexandre Fayolle on 25 August 2010, 15:02:31 UTC
also remove hgvq_rc.py which is generated by setup.py
also remove hgvq_rc.py which is generated by setup.py
Tip revision: 17c76bf
decorators.py
# -*- coding: utf-8 -*-
"""
Some useful decorator functions
"""
import time
def timeit(func):
"""Decorator used to time the execution of a function"""
def timefunc(*args, **kwargs):
"""wrapper"""
t_1 = time.time()
t_2 = time.clock()
res = func(*args, **kwargs)
t_3 = time.clock()
t_4 = time.time()
print "%s: %.2fms (time) %.2fms (clock)" % \
(func.func_name, 1000*(t_3 - t_2), 1000*(t_4 - t_1))
return res
return timefunc