Python装饰器 计时器记录方法执行性能

import time

def timeit(func):

  def wrapper():

    start = time.clock()

    func() end =time.clock()

    print 'used:', end - start

    return wrapper

@timeit

def foo():

  print 'in foo()' foo()

原文地址:https://www.cnblogs.com/AmilyWilly/p/6861942.html