MCPcopy Create free account
hub / github.com/Boris-code/feapder / log_function_time

Function log_function_time

feapder/utils/tools.py:107–121  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

105
106
107def log_function_time(func):
108 try:
109
110 @functools.wraps(func) # 将函数的原来属性付给新函数
111 def calculate_time(*args, **kw):
112 began_time = time.time()
113 callfunc = func(*args, **kw)
114 end_time = time.time()
115 log.debug(func.__name__ + " run time = " + str(end_time - began_time))
116 return callfunc
117
118 return calculate_time
119 except:
120 log.debug("求取时间无效 因为函数参数不符")
121 return func
122
123
124def run_safe_model(module_name):

Callers

nothing calls this directly

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected