class_docstr: Simple profiler allowing directed, hierarchical measurement of time
  intervals.
  
  By default, profilers are disabled.  To enable profiling, set the
  environment variable `VISPYPROFILE` to a comma-separated list of
  fully-qualified names of profiled functions.
  
  Calling a profiler registers a message (defaulting to an increasing
  counter) that contains the time elapsed since the last call.  When the
  profiler is about to be garbage-collected, the messages are passed to the
  outer profiler if one is running, or printed to stdout otherwise.
  
  If `delayed` is set to False, messages are immediately printed instead.
  
  Example:
      def function(...):
          profiler = Profiler()
          ... do stuff ...
          profiler('did stuff')
          ... do other stuff ...
          profiler('did other stuff')
          # profiler is garbage-collected and flushed at function end
  
  If this function is a method of class C, setting `VISPYPROFILE` to
  "C.function" (without the module name) will enable this profiler.
  
  For regular functions, use the qualified name of the function, stripping
  only the initial "vispy.." prefix from the module.
docstr: Optionally create a new profiler based on caller's qualname.
code: def __new__(cls, msg=None, disabled="env", delayed=True):
      """Optionally create a new profiler based on caller's qualname."""
      if disabled is True or (
          disabled == "env" and len(cls._profilers) == 0
      ):
          return cls._disabled_profiler
  
      # determine the qualified name of the caller function
      caller_frame = sys._getframe(1)
      try:
          caller_object_type = type(caller_frame.f_locals["self"])
      except KeyError:  # we are in a regular function
          qualifier = caller_frame.f_globals["__name__"].split(".", 1)[
              1
          ]
      else:  # we are in a method
          qualifier = caller_object_type.__name__
      func_qualname = qualifier + "." + caller_frame.f_code.co_name
      if (
          disabled == "env"
          and func_qualname not in cls._profilers
          and "all" not in cls._profilers
      ):  # don't do anything
          return cls._disabled_profiler
      # create an actual profiling object
      cls._depth += 1
      obj = super(Profiler, cls).__new__(cls)
      obj._name = msg or func_qualname
      obj._delayed = delayed
      obj._mark_count = 0
      obj._finished = False
      obj._firstTime = obj._last_time = ptime.time()
      obj._new_msg("> Entering " + obj._name)
      return obj
  
file_path: vispy/vispy/util/profiler.py
imports: import sys
  from .None import ptime
  from ..None import config
label_desc: Use image node_id 1 for calling the Profiler obj's underlying member method code with example usage: obj.__new__(cls, msg, disabled, delayed) and returns: obj, cls, cls