Staging
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision 22d51e4488477cf5e343a6dcb5ca7f12cf890c59 authored by Pierre-Yves David on 12 September 2013, 00:03:56 UTC, committed by Pierre-Yves David on 12 September 2013, 00:03:56 UTC
The documented value for `start_rev` (-1) is not a valid value. It may have been
in the past.
1 parent 9a4d9df
Raw File
Tip revision: 22d51e4488477cf5e343a6dcb5ca7f12cf890c59 authored by Pierre-Yves David on 12 September 2013, 00:03:56 UTC
[hggraph] remove wrong comment
Tip revision: 22d51e4
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
back to top