This commit is contained in:
yumoqing 2022-10-08 12:50:04 +08:00
parent 9d0dc1cccc
commit cbe9ef259e
2 changed files with 8 additions and 8 deletions

View File

@ -20,12 +20,6 @@ class TimeCost:
def clear(self): def clear(self):
timerecord = {} timerecord = {}
def getTimeCost(self,name):
x = timerecord.get(name,[])
if len(x) == 0:
return 0,0,0
return len(x), sum(x), sum(x)/len(x)
@classmethod @classmethod
def clear_all(self): def clear_all(self):
timerecord = {} timerecord = {}
@ -36,7 +30,13 @@ class TimeCost:
@classmethod @classmethod
def show(self): def show(self):
def getTimeCost(name):
x = timerecord.get(name,[])
if len(x) == 0:
return 0,0,0
return len(x), sum(x), sum(x)/len(x)
print('TimeCost ....') print('TimeCost ....')
for name in timerecord.keys(): for name in timerecord.keys():
print(name, * self.getTimeCost(name)) print(name, * getTimeCost(name))

View File

@ -1 +1 @@
__version__ = '5.1.22' __version__ = '5.1.23'