示例#1
0
 def stop(self):
     elapsed = python_timer() - self._start
     self._start = None
     if self._mode == "serial":
         return self._comm.allreduce(elapsed, op=MAX)
     elif self._mode == "parallel":
         return self._comm.allreduce(elapsed, op=SUM)
     else:
         raise ValueError("Invalid mode for timer")
示例#2
0
 def __float__(self):
     time_taken = python_timer() - self.start
     return round(time_taken, self.round_to) if self.round_to else time_taken
示例#3
0
 def __init__(self, round_to=None, **kwargs):
     self.start = python_timer()
     self.round_to = round_to
示例#4
0
文件: directives.py 项目: void4/hug
 def __float__(self):
     time_taken = python_timer() - self.start
     return round(time_taken,
                  self.round_to) if self.round_to else time_taken
示例#5
0
文件: directives.py 项目: void4/hug
 def __init__(self, round_to=None, **kwargs):
     self.start = python_timer()
     self.round_to = round_to
示例#6
0
 def start(self):
     self._start = python_timer()