class_docstr: A running stat for conveniently logging the duration of a code block.
  
  Example:
      wait_timer = TimerStat()
      with wait_timer:
          ray.wait(...)
  
  Note that this class is *not* thread-safe.
class_docstr_tok: ["A","running","stat","for","conveniently","logging","the","duration","of","a","code","block",".","Example",":","wait_timer","=","TimerStat","(",")","with","wait_timer",":","ray.wait","(","...",")","Note","that","this","class","is","*","not","*","thread-safe","."]
code: def __exit__(self, exc_type, exc_value, tb):
      assert self._start_time is not None
      time_delta = time.time() - self._start_time
      self.push(time_delta)
      self._start_time = None
  
file_path: ray/python/ray/util/timer.py
imports: import time
label_desc: Use image node_id 3 for calling the _Timer obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, tb) without return types