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_kernel_table(
      self, group_by="", search_name=None, time_unit="ms"
  ):
      if not self.kernel_parser:
          return
      data = OrderedDict()
      data["events"] = []
      total_gpu_time = 0
      for name, event in self.kernel_items.items():
          total_gpu_time += event.gpu_time
      if not search_name:
          if group_by == "kernel_name":
              data["column_name"] = [
                  "name",
                  "calls",
                  "total_time",
                  "avg_time",
                  "max_time",
                  "min_time",
                  "mean blocks per sm",
                  "mean est achieved occupancy",
                  "tensor core used",
                  "ratio",
              ]
              sorted_items = sorted(
                  self.kernel_items.items(),
                  key=lambda x: x[1].gpu_time,
                  reverse=True,
              )
              for name, item in sorted_items:
                  gpu_stage_data = OrderedDict()
                  gpu_stage_data["name"] = name
                  gpu_stage_data["calls"] = item.call
                  gpu_stage_data["total_time"] = format_time(
                      item.gpu_time, time_unit
                  )
                  gpu_stage_data["avg_time"] = format_time(
                      item.avg_gpu_time, time_unit
                  )
                  gpu_stage_data["max_time"] = format_time(
                      item.max_gpu_time, time_unit
                  )
                  gpu_stage_data["min_time"] = format_time(
                      item.min_gpu_time, time_unit
                  )
                  gpu_stage_data["mean blocks per sm"] = format_float(
                      item.sum_blocks_per_sm / item.call
                  )
                  gpu_stage_data[
                      "mean est achieved occupancy"
                  ] = format_float(item.sum_occupancy / item.call)
                  gpu_stage_data[
                      "tensor core used"
                  ] = item.tensorcore_used
                  gpu_stage_data["ratio"] = format_ratio(
                      item.gpu_time / total_gpu_time
                  )
                  data["events"].append(gpu_stage_data)
          else:
              data["column_name"] = [
                  "name",
                  "calls",
                  "operator",
                  "grid",
                  "block",
                  "register per thread",
                  "shared memory",
                  "total_time",
                  "avg_time",
                  "max_time",
                  "min_time",
                  "mean blocks per sm",
                  "mean est achieved occupancy",
                  "tensor core used",
                  "ratio",
              ]
              new_arrange_data = {}
              for (
                  name,
                  items_with_attributes,
              ) in self.kernel_items_with_op_name_attributes.items():
                  for attributes, item in items_with_attributes.items():
                      new_arrange_data[(name, attributes)] = item
              sorted_items = sorted(
                  new_arrange_data.items(),
                  key=lambda x: x[1].gpu_time,
                  reverse=True,
              )
              for (name, attributes), item in sorted_items:
                  (
                      operator,
                      grid,
                      block,
                      register_per_thread,
                      shared_memory,
                  ) = attributes.split("-")
                  gpu_stage_data = OrderedDict()
                  gpu_stage_data["name"] = name
                  gpu_stage_data["calls"] = item.call
                  gpu_stage_data["operator"] = operator
                  gpu_stage_data["grid"] = grid
                  gpu_stage_data["block"] = block
                  gpu_stage_data[
                      "register per thread"
                  ] = register_per_thread
                  gpu_stage_data["shared memory"] = shared_memory
                  gpu_stage_data["total_time"] = format_time(
                      item.gpu_time, time_unit
                  )
                  gpu_stage_data["avg_time"] = format_time(
                      item.avg_gpu_time, time_unit
                  )
                  gpu_stage_data["max_time"] = format_time(
                      item.max_gpu_time, time_unit
                  )
                  gpu_stage_data["min_time"] = format_time(
                      item.min_gpu_time, time_unit
                  )
                  gpu_stage_data["mean blocks per sm"] = format_float(
                      item.sum_blocks_per_sm / item.call
                  )
                  gpu_stage_data[
                      "mean est achieved occupancy"
                  ] = format_float(item.sum_occupancy / item.call)
                  gpu_stage_data[
                      "tensor core used"
                  ] = item.tensorcore_used
                  gpu_stage_data["ratio"] = format_ratio(
                      item.gpu_time / total_gpu_time
                  )
                  data["events"].append(gpu_stage_data)
  
      else:
          sorted_items = sorted(
              self.kernel_items.items(),
              key=lambda x: x[1].gpu_time,
              reverse=True,
          )
          results = []
          for kernel_name, item in sorted_items:
              if search_name in kernel_name:
                  results.append(kernel_name)
  
          if group_by == "kernel_name":
              data["column_name"] = [
                  "name",
                  "calls",
                  "total_time",
                  "avg_time",
                  "max_time",
                  "min_time",
                  "mean blocks per sm",
                  "mean est achieved occupancy",
                  "tensor core used",
                  "ratio",
              ]
              for kernel_name in results:
                  item = self.kernel_items[kernel_name]
                  gpu_stage_data = OrderedDict()
                  gpu_stage_data["name"] = kernel_name
                  gpu_stage_data["calls"] = item.call
                  gpu_stage_data["total_time"] = format_time(
                      item.gpu_time, time_unit
                  )
                  gpu_stage_data["avg_time"] = format_time(
                      item.avg_gpu_time, time_unit
                  )
                  gpu_stage_data["max_time"] = format_time(
                      item.max_gpu_time, time_unit
                  )
                  gpu_stage_data["min_time"] = format_time(
                      item.min_gpu_time, time_unit
                  )
                  gpu_stage_data["mean blocks per sm"] = format_float(
                      item.sum_blocks_per_sm / item.call
                  )
                  gpu_stage_data[
                      "mean est achieved occupancy"
                  ] = format_float(item.sum_occupancy / item.call)
                  gpu_stage_data[
                      "tensor core used"
                  ] = item.tensorcore_used
                  gpu_stage_data["ratio"] = format_ratio(
                      item.gpu_time / total_gpu_time
                  )
                  data["events"].append(gpu_stage_data)
          else:
              for kernel_name in results:
                  for (
                      items_with_attributes,
                      item,
                  ) in self.kernel_items_with_op_name_attributes[
                      kernel_name
                  ].items():
                      (
                          operator,
                          grid,
                          block,
                          register_per_thread,
                          shared_memory,
                      ) = attributes.split("-")
                      gpu_stage_data = OrderedDict()
                      gpu_stage_data["name"] = kernel_name
                      gpu_stage_data["calls"] = item.call
                      gpu_stage_data["operator"] = operator
                      gpu_stage_data["grid"] = grid
                      gpu_stage_data["block"] = block
                      gpu_stage_data[
                          "register per thread"
                      ] = register_per_thread
                      gpu_stage_data["shared memory"] = shared_memory
                      gpu_stage_data["total_time"] = format_time(
                          item.gpu_time, time_unit
                      )
                      gpu_stage_data["avg_time"] = format_time(
                          item.avg_gpu_time, time_unit
                      )
                      gpu_stage_data["max_time"] = format_time(
                          item.max_gpu_time, time_unit
                      )
                      gpu_stage_data["min_time"] = format_time(
                          item.min_gpu_time, time_unit
                      )
                      gpu_stage_data[
                          "mean blocks per sm"
                      ] = format_float(
                          item.sum_blocks_per_sm / item.call
                      )
                      gpu_stage_data[
                          "mean est achieved occupancy"
                      ] = format_float(item.sum_occupancy / item.call)
                      gpu_stage_data[
                          "tensor core used"
                      ] = item.tensorcore_used
                      gpu_stage_data["ratio"] = format_ratio(
                          item.gpu_time / total_gpu_time
                      )
                      data["events"].append(gpu_stage_data)
      return data
  
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 13 for calling the ProfilerData obj's underlying member method code with example usage: obj.get_kernel_table(group_by, search_name, time_unit) and returns: data