class_docstr: Class to collect timing tasks.
class_docstr_tok: ["Class","to","collect","timing","tasks","."]
docstr: The wall clock time since a task either began or ended
  
  Parameters
  ----------
  name : str
      The name of the task
  
  phase : Literal["start", "end"] = "start"
      From which phase you want to know the time elapsed since
  
  default: float = 0.0
      If None (default) then an error is raised if an answer can't be given.
  
  raises: bool = False
      Whether the method should raise if it can't find a valid time
  
  Returns
  -------
  float
      The time elapsed
  
  Raises
  ------
  ValueError
      If no default is specified and
      * the task has not been registered
      * the "start" and the task never started
      * the "end" and the task never started
docstr_tok: ["The","wall","clock","time","since","a","task","either","began","or","ended","Parameters","--","--","--","--","--","name",":","str","The","name","of","the","task","phase",":","Literal","[","``","start","''",",","``","end","''","]","=","``","start","''","From","which","phase","you","want","to","know","the","time","elapsed","since","default",":","float","=","0.0","If","None","(","default",")","then","an","error","is","raised","if","an","answer","ca","n't","be","given",".","raises",":","bool","=","False","Whether","the","method","should","raise","if","it","ca","n't","find","a","valid","time","Returns","--","--","--","-","float","The","time","elapsed","Raises","--","--","--","ValueError","If","no","default","is","specified","and","*","the","task","has","not","been","registered","*","the","``","start","''","and","the","task","never","started","*","the","``","end","''","and","the","task","never","started"]
code: def time_since(
      self,
      name: str,
      phase: Literal["start", "end"] = "start",
      default: float = 0.0,
      raises: bool = False,
  ) -> float:
      """The wall clock time since a task either began or ended
  
      Parameters
      ----------
      name : str
          The name of the task
  
      phase : Literal["start", "end"] = "start"
          From which phase you want to know the time elapsed since
  
      default: float = 0.0
          If None (default) then an error is raised if an answer can't be given.
  
      raises: bool = False
          Whether the method should raise if it can't find a valid time
  
      Returns
      -------
      float
          The time elapsed
  
      Raises
      ------
      ValueError
          If no default is specified and
          * the task has not been registered
          * the "start" and the task never started
          * the "end" and the task never started
      """
      task = self.tasks.get(name, None)
  
      if task is None:
          if raises:
              raise ValueError(
                  f"Task not listed in {list(self.tasks.keys())}"
              )
          else:
              return default
  
      if phase == "start":
          event_time = task.wall_start
      elif phase == "end":
          event_time = task.wall_end
      else:
          raise NotImplementedError()
  
      if event_time is None:
          if raises:
              raise ValueError(f"Task {task} has no time for {phase}")
          else:
              return default
  
      return time.time() - event_time
  
imports: from __future__ import annotations
  from typing import Iterator, Mapping, Optional, Tuple
  import sys
  import time
  from contextlib import contextmanager
  from itertools import repeat
  from typing_extensions import Literal
label_desc: Use image node_id 10 for calling the StopWatch obj's underlying member method code with example usage: obj.time_since(name, phase, default, raises) and returns: unknown, default, default