def withTiming(text='{func}() {time:.2f} ns'):
    'Append timing information to a function\n\n    Example:\n        @withTiming()\n        def function():\n            pass\n\n    '

    def timings_decorator(func):
        if (not TIMINGS):
            return func

        @wraps(func)
        def func_wrapper(*args, **kwargs):
            t0 = time.clock()
            try:
                return func(*args, **kwargs)
            finally:
                t1 = time.clock()
                duration = ((t1 - t0) * (10 ** 6))
                Stats.LastTiming = duration
                log.debug(text.format(func=func.__name__, time=duration))
        return func_wrapper
    return timings_decorator
Append timing information to a function

Example:
    @withTiming()
    def function():
        pass
def withTiming(text='{func}() {time:.2f} ns'):
    'Append timing information to a function\n\n    Example:\n        @withTiming()\n        def function():\n            pass\n\n    '

    def timings_decorator(func):
        if (not TIMINGS):
            return func

        @wraps(func)
        def func_wrapper(*args, **kwargs):
            t0 = time.clock()
            try:
                return func(*args, **kwargs)
            finally:
                t1 = time.clock()
                duration = ((t1 - t0) * (10 ** 6))
                Stats.LastTiming = duration
                log.debug(text.format(func=func.__name__, time=duration))
        return func_wrapper
    return timings_decorator