class_docstr: This profiler simply records the duration of actions (in seconds) and reports the mean duration of each action
  and the total time spent over the entire training run.
class_docstr_tok: ["This","profiler","simply","records","the","duration","of","actions","(","in","seconds",")","and","reports","the","mean","duration","of","each","action","and","the","total","time","spent","over","the","entire","training","run","."]
docstr: Args:
      dirpath: Directory path for the ``filename``. If ``dirpath`` is ``None`` but ``filename`` is present, the
          ``trainer.log_dir`` (from :class:`~lightning.pytorch.loggers.tensorboard.TensorBoardLogger`)
          will be used.
  
      filename: If present, filename where the profiler results will be saved instead of printing to stdout.
          The ``.txt`` extension will be used automatically.
  
      extended: If ``True``, adds extra columns representing number of calls and percentage of total time spent on
          respective action.
  
  Raises:
      ValueError:
          If you attempt to start an action which has already started, or
          if you attempt to stop recording an action which was never started.
docstr_tok: ["Args",":","dirpath",":","Directory","path","for","the","``","filename","``",".","If","``","dirpath","``","is","``","None","``","but","``","filename","``","is","present",",","the","``","trainer.log_dir","``","(","from",":","class",":","`","~lightning.pytorch.loggers.tensorboard.TensorBoardLogger","`",")","will","be","used",".","filename",":","If","present",",","filename","where","the","profiler","results","will","be","saved","instead","of","printing","to","stdout",".","The","``",".txt","``","extension","will","be","used","automatically",".","extended",":","If","``","True","``",",","adds","extra","columns","representing","number","of","calls","and","percentage","of","total","time","spent","on","respective","action",".","Raises",":","ValueError",":","If","you","attempt","to","start","an","action","which","has","already","started",",","or","if","you","attempt","to","stop","recording","an","action","which","was","never","started","."]
code: def __init__(
      self,
      dirpath: Optional[Union[str, Path]] = None,
      filename: Optional[str] = None,
      extended: bool = True,
  ) -> None:
      """
      Args:
          dirpath: Directory path for the ``filename``. If ``dirpath`` is ``None`` but ``filename`` is present, the
              ``trainer.log_dir`` (from :class:`~lightning.pytorch.loggers.tensorboard.TensorBoardLogger`)
              will be used.
  
          filename: If present, filename where the profiler results will be saved instead of printing to stdout.
              The ``.txt`` extension will be used automatically.
  
          extended: If ``True``, adds extra columns representing number of calls and percentage of total time spent on
              respective action.
  
      Raises:
          ValueError:
              If you attempt to start an action which has already started, or
              if you attempt to stop recording an action which was never started.
      """
      super().__init__(dirpath=dirpath, filename=filename)
      self.current_actions: Dict[str, float] = {}
      self.recorded_durations: Dict = defaultdict(list)
      self.extended = extended
      self.start_time = time.monotonic()
  
file_path: pytorch-lightning/src/lightning/pytorch/profilers/simple.py
imports: import logging
  import os
  import time
  from collections import defaultdict
  from pathlib import Path
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from typing_extensions import override
  from lightning.pytorch.profilers.profiler import Profiler
label_desc: Use image node_id 1 to create a new SimpleProfiler object from inherited base classes: Profiler with example: obj = SimpleProfiler(dirpath, filename, extended)