forked from flashlxy/PyMICAPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFnTime.py
29 lines (25 loc) · 790 Bytes
/
FnTime.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: FnTime
Description :
Author : Xianyao Liu
date: 2019/3/16
-------------------------------------------------
Change Activity:
2019/3/16
-------------------------------------------------
"""
import time
from functools import wraps
__author__ = 'Xianyao Liu'
def fn_timer(func):
@wraps(func)
def function_timer(*args, **kwargs):
t0 = time.time()
result = func(*args, **kwargs)
t1 = time.time()
# print("Total time running %s: %s seconds" % (func.__name__, str(t1 - t0)))
print("Total time running %s: %s seconds" % (func.__name__, str(t1 - t0)))
return result
return function_timer