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","."]
code: def summary(self) -> str:
      sep = os.linesep
      output_string = ""
      if self._stage is not None:
          output_string += f"{self._stage.upper()} "
      output_string += f"Profiler Report{sep}"
  
      if self.extended:
          if len(self.recorded_durations) > 0:
              max_key = max(len(k) for k in self.recorded_durations)
  
              def log_row_extended(
                  action: str,
                  mean: str,
                  num_calls: str,
                  total: str,
                  per: str,
              ) -> str:
                  row = (
                      f"{sep}|  {action:<{max_key}s}\t|  {mean:<15}\t|"
                  )
                  row += f"  {num_calls:<15}\t|  {total:<15}\t|  {per:<15}\t|"
                  return row
  
              header_string = log_row_extended(
                  "Action",
                  "Mean duration (s)",
                  "Num calls",
                  "Total time (s)",
                  "Percentage %",
              )
              output_string_len = len(header_string.expandtabs())
              sep_lines = f"{sep}{'-' * output_string_len}"
              output_string += sep_lines + header_string + sep_lines
              report_extended: _TABLE_DATA_EXTENDED
              (
                  report_extended,
                  total_calls,
                  total_duration,
              ) = self._make_report_extended()
              output_string += log_row_extended(
                  "Total",
                  "-",
                  f"{total_calls:}",
                  f"{total_duration:.5}",
                  "100 %",
              )
              output_string += sep_lines
              for (
                  action,
                  mean_duration,
                  num_calls,
                  total_duration,
                  duration_per,
              ) in report_extended:
                  output_string += log_row_extended(
                      action,
                      f"{mean_duration:.5}",
                      f"{num_calls}",
                      f"{total_duration:.5}",
                      f"{duration_per:.5}",
                  )
              output_string += sep_lines
      else:
          max_key = max(len(k) for k in self.recorded_durations)
  
          def log_row(action: str, mean: str, total: str) -> str:
              return f"{sep}|  {action:<{max_key}s}\t|  {mean:<15}\t|  {total:<15}\t|"
  
          header_string = log_row(
              "Action", "Mean duration (s)", "Total time (s)"
          )
          output_string_len = len(header_string.expandtabs())
          sep_lines = f"{sep}{'-' * output_string_len}"
          output_string += sep_lines + header_string + sep_lines
          report = self._make_report()
  
          for action, mean_duration, total_duration in report:
              output_string += log_row(
                  action, f"{mean_duration:.5}", f"{total_duration:.5}"
              )
          output_string += sep_lines
      output_string += sep
      return output_string
  
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 6 for calling the SimpleProfiler obj's underlying member method code with example usage: obj.summary() and returns: output_string, sep, str, action, str, mean, str, total, str, row