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 _create_wrapped_handler(
      self, handler: Callable, event: EventEnum
  ) -> Callable:
      @functools.wraps(handler)
      def _timeit_handler(*args: Any, **kwargs: Any) -> None:
          self._event_handlers_timer.reset()
          handler(*args, **kwargs)
          t = self._event_handlers_timer.value()
          hname = self._get_callable_name(handler)
          # filter profiled time if the handler was attached to event with event filter
          if (
              not hasattr(handler, "_parent")
              or t >= self.EVENT_FILTER_THESHOLD_TIME
          ):
              self.event_handlers_times[event][hname].append(t)
  
      # required to revert back to original handler after profiling
      setattr(_timeit_handler, "_profiler_original", handler)
      return _timeit_handler
  
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 3 for calling the HandlersTimeProfiler obj's underlying member method code with example usage: obj._create_wrapped_handler(handler, event) and returns: _timeit_handler