class_docstr: Analyse time ranges for each TracerEventType, and summarize the time.
docstr: Analysis node trees in profiler result, and get time range for different tracer event type.
docstr_tok: ["Analysis","node","trees","in","profiler","result",",","and","get","time","range","for","different","tracer","event","type","."]
code: def parse(self, nodetrees):  # noqa: C901
      r"""
      Analysis node trees in profiler result, and get time range for different tracer event type.
      """
      self._parse_events(nodetrees)
      # statistic calling times
      # merge time, get time summarization
      for stage_name, stage_data in self.events_per_stage.items():
          for device_name, steps_data in stage_data.items():
              for step_idx, thread_data in steps_data.items():
                  for thread_id, events in thread_data.items():
                      for event_type, events_data in events.items():
                          if (
                              "calls"
                              not in self.merged_events_per_stage[
                                  stage_name
                              ][device_name][step_idx][event_type]
                          ):
                              self.merged_events_per_stage[stage_name][
                                  device_name
                              ][step_idx][event_type]["calls"] = 0
                          if (
                              "total_time"
                              not in self.merged_events_per_stage[
                                  stage_name
                              ][device_name][step_idx][event_type]
                          ):
                              self.merged_events_per_stage[stage_name][
                                  device_name
                              ][step_idx][event_type]["total_time"] = 0
                          events_data["times"] = merge_self_ranges(
                              events_data["times"], is_sorted=False
                          )
                          self.merged_events_per_stage[stage_name][
                              device_name
                          ][step_idx][event_type]["calls"] += len(
                              events_data["events"]
                          )
                          self.merged_events_per_stage[stage_name][
                              device_name
                          ][step_idx][event_type][
                              "times"
                          ] = merge_ranges(
                              self.merged_events_per_stage[stage_name][
                                  device_name
                              ][step_idx][event_type]["times"],
                              events_data["times"],
                              is_sorted=True,
                          )
  
      # merge different stages into profile step
      stage_names = list(self.merged_events_per_stage.keys())
      self.merged_events_per_stage["ProfileStep"]
      for stage_name in stage_names:
          stage_data = self.merged_events_per_stage[stage_name]
          for device_name, steps_data in stage_data.items():
              for step_idx, events in steps_data.items():
                  for event_type, events_data in events.items():
                      events_data["total_time"] = sum_ranges(
                          events_data["times"]
                      )
                      if (
                          "calls"
                          not in self.merged_events_per_stage[
                              "ProfileStep"
                          ][device_name][step_idx][event_type]
                      ):
                          self.merged_events_per_stage["ProfileStep"][
                              device_name
                          ][step_idx][event_type]["calls"] = 0
                      if (
                          "total_time"
                          not in self.merged_events_per_stage[
                              "ProfileStep"
                          ][device_name][step_idx][event_type]
                      ):
                          self.merged_events_per_stage["ProfileStep"][
                              device_name
                          ][step_idx][event_type]["total_time"] = 0
                      self.merged_events_per_stage["ProfileStep"][
                          device_name
                      ][step_idx][event_type]["calls"] += events_data[
                          "calls"
                      ]
                      self.merged_events_per_stage["ProfileStep"][
                          device_name
                      ][step_idx][event_type][
                          "total_time"
                      ] += events_data[
                          "total_time"
                      ]
                      self.merged_events_per_stage["ProfileStep"][
                          device_name
                      ][step_idx][event_type]["times"] = merge_ranges(
                          self.merged_events_per_stage["ProfileStep"][
                              device_name
                          ][step_idx][event_type]["times"],
                          events_data["times"],
                          is_sorted=True,
                      )
  
      # add gpu time for model perspective summary
      for (
          stage_name,
          stage_data,
      ) in self.merged_events_per_stage.items():
          for device_name, steps_data in stage_data.items():
              for step_idx, events in steps_data.items():
                  if "Kernel" in events:
                      if step_idx == "ALL":
                          self.model_perspective_items[
                              stage_name
                          ].set_gpu_time(events["Kernel"]["total_time"])
                          continue
                      self.model_perspective_items[
                          stage_name
                      ].add_gpu_time(events["Kernel"]["total_time"])
                      self.model_perspective_items[
                          stage_name
                      ].gpu_times[step_idx] = events["Kernel"][
                          "total_time"
                      ]
  
      if self.has_device:
          self.gpu_ulitization = (
              self.merged_events_per_stage["ProfileStep"]["GPU"]["ALL"][
                  "Kernel"
              ]["total_time"]
              / self.model_perspective_items["ProfileStep"].cpu_time
          )
  
imports: import collections
  from .utils import merge_ranges
  from .utils import merge_self_ranges
  from .utils import rebuild_node_trees
  from .utils import sum_ranges
  from .utils import traverse_tree
label_desc: Use image node_id 2 for calling the OverviewParser obj's underlying member method code with example usage: obj.parse(nodetrees) without return types