class_docstr: Accumulate stats (from timers) over many iterations
class_docstr_tok: ["Accumulate","stats","(","from","timers",")","over","many","iterations"]
code: def update_with_timer(self, timer: PerfTimer):
      self._host_stats[timer.name].update(timer._last_interval)
  
      if self.use_cuda_events():
          if (
              len(self._cuda_pending_timers)
              >= self._cuda_pending_timers.maxlen
          ):
              logging.error(
                  "Too many pending timers. CudaEvent-based stats will be inaccurate!"
              )
          else:
              self._cuda_pending_timers.append(timer)
          self._process_cuda_events()
  
imports: import logging
  from collections import defaultdict, deque
  from time import perf_counter
  from typing import List, Mapping, Optional, Tuple
  import torch
  from torch.cuda import Event
label_desc: Use image node_id 2 for calling the PerfStats obj's underlying member method code with example usage: obj.update_with_timer(timer) without return types