本文整理汇总了Python中Timer.Timer.inc_time方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.inc_time方法的具体用法?Python Timer.inc_time怎么用?Python Timer.inc_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer.Timer
的用法示例。
在下文中一共展示了Timer.inc_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Timer import Timer [as 别名]
# 或者: from Timer.Timer import inc_time [as 别名]
#.........这里部分代码省略.........
for user in self.userNodes:
user.receive()
for user in self.userNodes:
user.send()
for user in self.userNodes:
curNetIn, curNetOut = user.get_cur_net_stat()
self.userCurNetIn[user.id] += curNetIn
self.userCurNetOut[user.id] += curNetOut
for user in self.userNodes:
self.isDone = self.isDone and user.is_done()
if not self.isDone:
break
for user in self.userNodes:
self.msgRecCnt += user.get_new_msg_count()
for user in self.userNodes:
user.rand_fail()
def simulate(self):
cnt = 0
minCnt = 0
self.msgRecCnt = 0
self.msgRecExpCnt = 0
fLog = open(self.logFileName, "w")
while not self.isDone:
if minCnt >= self.EXP_LEN:
break
self._one_second()
self.timer.inc_time()
#sTmpIn, sTmpOut, sSbTmpOut = self.server.get_cur_net_stat()
#self.serverCurNetIn += sTmpIn
#self.serverCurNetOut += sTmpOut
#self.serverSbCurNetOut += sSbTmpOut
cnt += 1
#print cnt
if cnt >= self.ONE_MINUTE:
cnt = 0
minCnt += 1
print minCnt
#read stat from users
i = 0
inS = 0
inS2 = 0
outS = 0
outS2 = 0
delayMin = self.INFTY
delayMax = 0
delayS = 0
userCnt = 0
self.log_user_net(self.userCurNetIn, self.userCurNetOut)
while i < self.userNodeNum:
#first translate the network stat into KB, otherwise it is too large
self.userCurNetIn[i] = self.userCurNetIn[i] / 1000.0
self.userCurNetOut[i] = self.userCurNetOut[i] / 1000.0
self.userAccNetIn[i] += self.userCurNetIn[i]
self.userAccNetOut[i] += self.userCurNetOut[i]
inS += self.userCurNetIn[i]
inS2 += (self.userCurNetIn[i] ** 2)