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_pie(self, topk, time_unit="ms"):
      if not self.kernel_parser:
          return
      data = OrderedDict()
      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",
      ]
  
      data["events"] = []
  
      sorted_items = sorted(
          self.kernel_items.items(),
          key=lambda x: x[1].gpu_time,
          reverse=True,
      )
  
      if topk <= 0:
          items = sorted_items
      else:
          items = sorted_items[:topk]
  
      total_gpu_time = 0.0
      for kernel_name, item in items:
          total_gpu_time += item.gpu_time
  
      for kernel_name, item in items:
          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)
      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 12 for calling the ProfilerData obj's underlying member method code with example usage: obj.get_kernel_pie(topk, time_unit) and returns: data