class_docstr: BasicTimeProfiler can be used to profile the handlers,
  events, data loading and data processing times.
  
  Examples:
      .. code-block:: python
  
          from ignite.handlers import BasicTimeProfiler
  
          trainer = Engine(train_updater)
  
          # Create an object of the profiler and attach an engine to it
          profiler = BasicTimeProfiler()
          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: ["BasicTimeProfiler","can","be","used","to","profile","the","handlers",",","events",",","data","loading","and","data","processing","times",".","Examples",":","..","code-block",":",":","python","from","ignite.handlers","import","BasicTimeProfiler","trainer","=","Engine","(","train_updater",")","#","Create","an","object","of","the","profiler","and","attach","an","engine","to","it","profiler","=","BasicTimeProfiler","(",")","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"]
docstr: Method to store the unaggregated profiling results to a csv file
  
  Args:
      output_path: file output path containing a filename
  
  .. code-block:: python
  
      profiler.write_results('path_to_dir/awesome_filename.csv')
  
  Examples:
      .. code-block:: text
  
          -----------------------------------------------------------------
          epoch iteration processing_stats dataflow_stats Event_STARTED ...
          1.0     1.0        0.00003         0.252387        0.125676
          1.0     2.0        0.00029         0.252342        0.125123
code: def write_results(self, output_path: str) -> None:
      """
      Method to store the unaggregated profiling results to a csv file
  
      Args:
          output_path: file output path containing a filename
  
      .. code-block:: python
  
          profiler.write_results('path_to_dir/awesome_filename.csv')
  
      Examples:
          .. code-block:: text
  
              -----------------------------------------------------------------
              epoch iteration processing_stats dataflow_stats Event_STARTED ...
              1.0     1.0        0.00003         0.252387        0.125676
              1.0     2.0        0.00029         0.252342        0.125123
  
      """
      try:
          import pandas as pd
      except ImportError:
          raise ModuleNotFoundError(
              "Need pandas to write results as files"
          )
  
      iters_per_epoch = self.total_num_iters // self.max_epochs
  
      epochs = (
          torch.arange(
              self.max_epochs, dtype=torch.float32
          ).repeat_interleave(iters_per_epoch)
          + 1
      )
      iterations = (
          torch.arange(self.total_num_iters, dtype=torch.float32) + 1
      )
      processing_stats = self.processing_times
      dataflow_stats = self.dataflow_times
  
      event_started = self.event_handlers_times[
          Events.STARTED
      ].repeat_interleave(self.total_num_iters)
      event_completed = self.event_handlers_times[
          Events.COMPLETED
      ].repeat_interleave(self.total_num_iters)
      event_epoch_started = self.event_handlers_times[
          Events.EPOCH_STARTED
      ].repeat_interleave(iters_per_epoch)
      event_epoch_completed = self.event_handlers_times[
          Events.EPOCH_COMPLETED
      ].repeat_interleave(iters_per_epoch)
  
      event_iter_started = self.event_handlers_times[
          Events.ITERATION_STARTED
      ]
      event_iter_completed = self.event_handlers_times[
          Events.ITERATION_COMPLETED
      ]
      event_batch_started = self.event_handlers_times[
          Events.GET_BATCH_STARTED
      ]
      event_batch_completed = self.event_handlers_times[
          Events.GET_BATCH_COMPLETED
      ]
  
      results_dump = torch.stack(
          [
              epochs,
              iterations,
              processing_stats,
              dataflow_stats,
              event_started,
              event_completed,
              event_epoch_started,
              event_epoch_completed,
              event_iter_started,
              event_iter_completed,
              event_batch_started,
              event_batch_completed,
          ],
          dim=1,
      ).numpy()
  
      results_df = pd.DataFrame(
          data=results_dump,
          columns=[
              "epoch",
              "iteration",
              "processing_stats",
              "dataflow_stats",
              "Event_STARTED",
              "Event_COMPLETED",
              "Event_EPOCH_STARTED",
              "Event_EPOCH_COMPLETED",
              "Event_ITERATION_STARTED",
              "Event_ITERATION_COMPLETED",
              "Event_GET_BATCH_STARTED",
              "Event_GET_BATCH_COMPLETED",
          ],
      )
      results_df.to_csv(output_path, index=False)
  
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 22 for calling the BasicTimeProfiler obj's underlying member method code with example usage: obj.write_results(output_path) without return types