from functools
import wraps
from line_profiler import LineProfiler
from line_profiler.explicit_profiler import profile
def func_line(f):
@wraps(f)
def decorator(*args, **kwargs):
lp = LineProfiler()
lp_wrap = lp(f)
results = lp_wrap(*args, **kwargs)
lp.print_stats()
return results
return decorator
在路由函数加上装饰器