1from functools import wraps
2from time import time
3def measure(func):
4 @wraps(func)
5 def _time_it(*args, **kwargs):
6 start = int(round(time() * 1000))
7 try:
8 return func(*args, **kwargs)
9 finally:
10 end_ = int(round(time() * 1000)) - start
11 print(f"Total execution time: {end_ if end_ > 0 else 0} ms")
12 return _time_it
13@measure
14def hello():
15 print('hello world')
16
17hello()