import time
def tm(*arg, **kwargs):
def wrap_fun(fun):
def wrap_arg(*arg, **kwargs):
print time.time()
fun(*arg, **kwargs)
print time.time()
return wrap_arg
return wrap_fun
@tm()
def test(x,y):
print "x+y=" + str(x+y)
@tm()
def test1():
print "no args"
@tm()
def test2(str):
print "args = " + str
test(23,34)
test1()
test2("sdfsdfsdjklfsdkf")