class_docstr: Hold all parsed data to serve for user requests.
class_docstr_tok: ["Hold","all","parsed","data","to","serve","for","user","requests","."]
code: def get_device_infos(self):
      if not self.overview_parser:
          return
      if not self.overview_parser.has_device:
          device_type = "CPU"
          return {
              "device_type": device_type,
              "CPU": {
                  "process_utilization": format_ratio(
                      float(self.extra_infos["Process Cpu Utilization"])
                  ),
                  "system_utilization": format_ratio(
                      float(self.extra_infos["System Cpu Utilization"])
                  ),
              },
          }
      else:
          device_type = "GPU"
          gpu_id = int(next(iter(self.gpu_ids)))
          if gpu_id in self.device_infos:
              return {
                  "device_type": device_type,
                  "CPU": {
                      "process_utilization": format_ratio(
                          float(
                              self.extra_infos[
                                  "Process Cpu Utilization"
                              ]
                          )
                      ),
                      "system_utilization": format_ratio(
                          float(
                              self.extra_infos["System Cpu Utilization"]
                          )
                      ),
                  },
                  "GPU": {
                      "name": self.device_infos[gpu_id]["name"],
                      "memory": "{} GB".format(
                          format_memory(
                              self.device_infos[gpu_id][
                                  "totalGlobalMem"
                              ],
                              "GB",
                          )
                      ),
                      "compute_capability": "{}.{}".format(
                          self.device_infos[gpu_id]["computeMajor"],
                          self.device_infos[gpu_id]["computeMinor"],
                      ),
                      "utilization": format_ratio(self.gpu_ulitization),
                      "sm_efficiency": format_ratio(
                          self.sm_efficiency
                          / self.model_perspective_items[
                              "ProfileStep"
                          ].cpu_time
                      ),
                      "achieved_occupancy": format_ratio(
                          self.occupancy
                      ),
                      "tensor_core_percentage": format_ratio(
                          self.tensorcore_ratio
                      ),
                  },
              }
          else:
              return {
                  "device_type": device_type,
                  "CPU": {
                      "process_utilization": format_ratio(
                          float(
                              self.extra_infos[
                                  "Process Cpu Utilization"
                              ]
                          )
                      ),
                      "system_utilization": format_ratio(
                          float(
                              self.extra_infos["System Cpu Utilization"]
                          )
                      ),
                  },
                  "GPU": {
                      "name": "-",
                      "memory": "-",
                      "compute_capability": "-",
                      "utilization": format_ratio(self.gpu_ulitization),
                      "sm_efficiency": format_ratio(
                          self.sm_efficiency
                          / self.model_perspective_items[
                              "ProfileStep"
                          ].cpu_time
                      ),
                      "achieved_occupancy": format_ratio(
                          self.occupancy
                      ),
                      "tensor_core_percentage": format_ratio(
                          self.tensorcore_ratio
                      ),
                  },
              }
  
imports: from collections import defaultdict
  from collections import OrderedDict
  from .parser.distributed_parser import DistributedParser
  from .parser.kernel_parser import KernelParser
  from .parser.memory_parser import MemoryParser
  from .parser.operator_parser import OperatorParser
  from .parser.overview_parser import CPUType
  from .parser.overview_parser import GPUType
  from .parser.overview_parser import OverviewParser
  from .parser.trace_parser import TraceParser
  from .parser.utils import format_float
  from .parser.utils import format_memory
  from .parser.utils import format_ratio
  from .parser.utils import format_time
  from .parser.utils import traverse_tree
label_desc: Use image node_id 3 for calling the ProfilerData obj's underlying member method code with example usage: obj.get_device_infos() and returns: dict, dict, dict