class_docstr: Class for timing execution speed of small code snippets.
  
  The constructor takes a statement to be timed, an additional
  statement used for setup, and a timer function.  Both statements
  default to 'pass'; the timer function is platform-dependent (see
  module doc string).  If 'globals' is specified, the code will be
  executed within that namespace (as opposed to inside timeit's
  namespace).
  
  To measure the execution time of the first statement, use the
  timeit() method.  The repeat() method is a convenience to call
  timeit() multiple times and return a list of results.
  
  The statements may contain newlines, as long as they don't contain
  multi-line string literals.
docstr: Constructor.  See class doc string.
docstr_tok: ["Constructor",".","See","class","doc","string","."]
code: def __init__(
      self, stmt="pass", setup="pass", timer=default_timer, globals=None
  ):
      """Constructor.  See class doc string."""
      self.timer = timer
      local_ns = {}
      global_ns = _globals() if globals is None else globals
      init = ""
      if isinstance(setup, str):
          # Check that the code can be compiled outside a function
          compile(setup, dummy_src_name, "exec")
          stmtprefix = setup + "\n"
          setup = reindent(setup, 4)
      elif callable(setup):
          local_ns["_setup"] = setup
          init += ", _setup=_setup"
          stmtprefix = ""
          setup = "_setup()"
      else:
          raise ValueError("setup is neither a string nor callable")
      if isinstance(stmt, str):
          # Check that the code can be compiled outside a function
          compile(stmtprefix + stmt, dummy_src_name, "exec")
          stmt = reindent(stmt, 8)
      elif callable(stmt):
          local_ns["_stmt"] = stmt
          init += ", _stmt=_stmt"
          stmt = "_stmt()"
      else:
          raise ValueError("stmt is neither a string nor callable")
      src = template.format(stmt=stmt, setup=setup, init=init)
      self.src = src  # Save for traceback display
      code = compile(src, dummy_src_name, "exec")
      exec(code, global_ns, local_ns)
      self.inner = local_ns["inner"]
  
file_path: cpython/Lib/timeit.py
imports: import gc
  import itertools
  import sys
  import time
label_desc: Use image node_id 1 to create a new Timer object  with example: obj = Timer(stmt, setup, timer, globals)