class_docstr: HandlersTimeProfiler can be used to profile the handlers,
  data loading and data processing times. Custom events are also
  profiled by this profiler
  
  Examples:
      .. code-block:: python
  
          from ignite.handlers import HandlersTimeProfiler
  
          trainer = Engine(train_updater)
  
          # Create an object of the profiler and attach an engine to it
          profiler = HandlersTimeProfiler()
          profiler.attach(trainer)
  
          @trainer.on(Events.EPOCH_COMPLETED)
          def log_intermediate_results():
              profiler.print_results(profiler.get_results())
  
          trainer.run(dataloader, max_epochs=3)
  
          profiler.write_results('path_to_dir/time_profiling.csv')
  
  .. versionadded:: 0.4.6
class_docstr_tok: ["HandlersTimeProfiler","can","be","used","to","profile","the","handlers",",","data","loading","and","data","processing","times",".","Custom","events","are","also","profiled","by","this","profiler","Examples",":","..","code-block",":",":","python","from","ignite.handlers","import","HandlersTimeProfiler","trainer","=","Engine","(","train_updater",")","#","Create","an","object","of","the","profiler","and","attach","an","engine","to","it","profiler","=","HandlersTimeProfiler","(",")","profiler.attach","(","trainer",")","@","trainer.on","(","Events.EPOCH_COMPLETED",")","def","log_intermediate_results","(",")",":","profiler.print_results","(","profiler.get_results","(",")",")","trainer.run","(","dataloader",",","max_epochs=3",")","profiler.write_results","(","'path_to_dir\/time_profiling.csv","'",")","..","versionadded",":",":","0.4.6"]
code: def _as_first_started(self, engine: Engine) -> None:
      # wraps original handlers for profiling
  
      self.event_handlers_names = {
          e: [
              self._get_callable_name(h)
              for (h, _, _) in engine._event_handlers[e]
              if not self._is_internal_handler(h)
          ]
          for e in engine._allowed_events
      }
  
      self._reset(self.event_handlers_names)
  
      for e in engine._allowed_events:
          for i, (func, args, kwargs) in enumerate(
              engine._event_handlers[e]
          ):
              if not self._is_internal_handler(func):
                  engine._event_handlers[e][i] = (
                      self._create_wrapped_handler(func, e),
                      args,
                      kwargs,
                  )
  
      # processing timer
      engine.add_event_handler(
          Events.ITERATION_STARTED, self._processing_timer.reset
      )
      engine._event_handlers[Events.ITERATION_COMPLETED].insert(
          0, (self._timeit_processing, (), {})
      )
  
      # dataflow timer
      engine.add_event_handler(
          Events.GET_BATCH_STARTED, self._dataflow_timer.reset
      )
      engine._event_handlers[Events.GET_BATCH_COMPLETED].insert(
          0, (self._timeit_dataflow, (), {})
      )
  
      # revert back the wrapped handlers with original handlers at the end
      engine.add_event_handler(
          Events.COMPLETED, self._detach_profiler_handlers
      )
  
imports: import functools
  from collections import OrderedDict
  from typing import Any, Callable, cast, Dict, List, Mapping, Sequence, Tuple, Union
  import torch
  from ignite.engine import Engine, EventEnum, Events
  from ignite.handlers.timing import Timer
label_desc: Use image node_id 9 for calling the HandlersTimeProfiler obj's underlying member method code with example usage: obj._as_first_started(engine) without return types