docstr: Returns
  -------
  List of tuples:
  
  - begin timestamp
  - end timestamp
  - Scheduler.total_nthreads during this interval
  
  When the Span is the output of :meth:`merge`, the intervals may not be
  contiguous.
  
  See Also
  --------
  enqueued
  stop
  active_cpu_seconds
  distributed.scheduler.SchedulerState.total_nthreads
docstr_tok: ["Returns","--","--","--","-","List","of","tuples",":","-","begin","timestamp","-","end","timestamp","-","Scheduler.total_nthreads","during","this","interval","When","the","Span","is","the","output","of",":","meth",":","`","merge","`",",","the","intervals","may","not","be","contiguous",".","See","Also","--","--","--","--","enqueued","stop","active_cpu_seconds","distributed.scheduler.SchedulerState.total_nthreads"]
code: def nthreads_intervals(self) -> list[tuple[float, float, int]]:
      """
      Returns
      -------
      List of tuples:
  
      - begin timestamp
      - end timestamp
      - Scheduler.total_nthreads during this interval
  
      When the Span is the output of :meth:`merge`, the intervals may not be
      contiguous.
  
      See Also
      --------
      enqueued
      stop
      active_cpu_seconds
      distributed.scheduler.SchedulerState.total_nthreads
      """
      nthreads_t, nthreads_count = zip(*self._nthreads_timeseries())
      is_active_t, is_active_flag = zip(*self._active_timeseries())
      t_interp = sorted({*nthreads_t, *is_active_t})
      nthreads_count_interp = ffill(
          t_interp, nthreads_t, nthreads_count, left=0
      )
      is_active_flag_interp = ffill(
          t_interp, is_active_t, is_active_flag, left=False
      )
      return [
          (t0, t1, n)
          for t0, t1, n, active in zip(
              t_interp,
              t_interp[1:],
              nthreads_count_interp,
              is_active_flag_interp,
          )
          if active
      ]
  
imports: from __future__ import annotations
  import uuid
  import weakref
  from collections import defaultdict
  from collections.abc import Hashable, Iterable, Iterator
  from contextlib import contextmanager
  from itertools import islice
  from typing import TYPE_CHECKING, Any
  import dask.config
  from dask.typing import Key
  from distributed.collections import sum_mappings
  from distributed.itertools import ffill
  from distributed.metrics import time
label_desc: Use image node_id 19 for calling the Span obj's underlying member method code with example usage: obj.nthreads_intervals() and returns: unknown