reference:https://blog.youkuaiyun.com/wangshuang1631/article/details/54286551
python脚本使用统计时间的方式是time.clock(),而这种方式统计的是CPU的执行时间,不是程序的执行时间。
区分 程序进行时间 与 CPU运行时间
reference: https://blog.youkuaiyun.com/Dedsec_Xu/article/details/81332590
def time_function(f, *args):
"""
Call a function f with args and return the time (in seconds) that it took to execute.
"""
import time
tic = time.time()
f(*args)
toc = time.time()
return toc - tic