class_docstr: Profiler that triggers start of DCGM profiler.
class_docstr_tok: ["Profiler","that","triggers","start","of","DCGM","profiler","."]
code: def step(self) -> None:
      if self.dcgmGroup is not None and self.dcgmFieldGroup is not None:
          # Collect the profiling results.
          self.dcgmGroup.samples.GetAllSinceLastCall(
              self.profiling_results, self.dcgmFieldGroup
          )
  
          # Save profiling results to log.
          for gpu_id in self.profiling_results.values.keys():
              for field_id in self.profiling_results.values[
                  gpu_id
              ].keys():
                  field_name = DcgmFieldGetById(field_id).tag
  
                  field_avg_val = 0.0
                  num_vals = 0
                  for gpu_field_time in self.profiling_results.values[
                      gpu_id
                  ][field_id]:
                      if gpu_field_time.value is not None:
                          field_avg_val = (
                              field_avg_val * num_vals
                              + gpu_field_time.value
                          ) / (num_vals + 1)
                          num_vals += 1
                  self.main_profiler.summary.append(
                      (
                          f"GPU {gpu_id}, {field_name}({field_id})",
                          f"{field_avg_val}",
                      )
                  )
  
          # Clear the profiling results to get ready for the next collection.
          self.profiling_results.EmptyValues()
  
file_path: xformers/xformers/profiler/profiler_dcgm_impl.py
imports: from typing import List, Optional, Set, Tuple, Union
  import dcgm_fields
  import torch
  from dcgm_fields import DcgmFieldGetById
  from dcgm_structs import DCGM_GROUP_EMPTY, DCGM_OPERATION_MODE_AUTO
  from pydcgm import DcgmFieldGroup, DcgmGroup, DcgmHandle
  from .profiler import _Profiler, logger
label_desc: Use image node_id 7 for calling the DCGMProfiler obj's underlying member method code with example usage: obj.step() without return types