class_docstr: An object that measures runtimes, accumulates them and computes
  a running fraction of the recent runtimes over the corresponding
  elapsed time.
class_docstr_tok: ["An","object","that","measures","runtimes",",","accumulates","them","and","computes","a","running","fraction","of","the","recent","runtimes","over","the","corresponding","elapsed","time","."]
code: def _add_measurement(self, start, stop):
      start_stops = self._start_stops
      durations = self._durations
      if stop < start or (start_stops and start < start_stops[-1][1]):
          # Ignore if non-monotonic
          return
  
      # Use integers to ensure exact running sum computation
      duration = int((stop - start) * self.MULT)
      start_stops.append((start, stop))
      durations.append(duration)
  
      n = len(durations)
      assert n == len(start_stops)
      if n >= self._n_samples:
          if self._running_sum is None:
              assert n == self._n_samples
              self._running_sum = sum(durations)
          else:
              old_start, old_stop = start_stops.popleft()
              old_duration = durations.popleft()
              self._running_sum += duration - old_duration
              if stop >= old_start:
                  self._running_fraction = (
                      self._running_sum / (stop - old_stop) / self.MULT
                  )
  
imports: from __future__ import annotations
  import gc
  import logging
  import threading
  from collections import deque
  import psutil
  from dask.utils import format_bytes
  from distributed.metrics import thread_time
label_desc: Use image node_id 2 for calling the FractionalTimer obj's underlying member method code with example usage: obj._add_measurement(start, stop) without return types