parameters: (self)
return_statement: return [bottleneck], [suggestion]
docstring: analyze bottleneck by using both cpu and queue usage
docstring_summary: analyze bottleneck by using both cpu and queue usage
docstring_tokens: analyze bottleneck by using both cpu and queue usage
function: def analyze_bottleneck(self):
          """ analyze bottleneck by using both cpu and queue usage """
          bottleneck, suggestion = "", ""
          for op_id in reversed(self.op_ids):
              in_op_id, out_q = self.__get_non_inline_child_recur(
                  op_id), self.queue_utilization_pct[op_id]
              wkr_cpu = self.avg_cpu_pct_per_worker[op_id]
              if op_id == self.op_id_not_exist or \
                      self.op_names[op_id] in self.non_multithreaded_ops \
                      or self.op_names[op_id] == "DeviceQueue":
                  continue
  
              if wkr_cpu > self._AVG_CPU_UTIL_PCT_PER_WORKER_MAXIMUM:
                  bottleneck = self.pipeline_ops[op_id]
                  suggestion = "{} has high CPU utilization per worker of {}%".format(
                      self.pipeline_ops[op_id], wkr_cpu)
                  suggestion += " Try increasing num_parallel_workers above {}.".format(self.num_workers[op_id])
              elif wkr_cpu < self._AVG_CPU_UTIL_PCT_PER_WORKER_MINIMUM:
                  in_op_id = self.__get_non_inline_child_recur(op_id)
                  in_q_usage = self.queue_utilization_pct[in_op_id]
                  if in_op_id != self.op_id_not_exist and (
                          in_q_usage < self._IN_QUEUE_UTIL_PCT_MAXIMUM or out_q -
                          in_q_usage > self._IN_OUT_QUEUE_UTIL_PCT_DIFF_MAXIMUM):
                      bottleneck = self.pipeline_ops[op_id]
                      suggestion = "{} has low CPU utilization per worker of {}%".format(
                          self.pipeline_ops[op_id], wkr_cpu)
                      suggestion += " and abnormal queue usage. Try increasing prefetch_size."
  
          return [bottleneck], [suggestion]
function_tokens: def analyze_bottleneck ( self ) : bottleneck , suggestion = "" , "" for op_id in reversed ( self . op_ids ) : in_op_id , out_q = self . __get_non_inline_child_recur ( op_id ) , self . queue_utilization_pct [ op_id ] wkr_cpu = self . avg_cpu_pct_per_worker [ op_id ] if op_id == self . op_id_not_exist or self . op_names [ op_id ] in self . non_multithreaded_ops or self . op_names [ op_id ] == "DeviceQueue" : continue if wkr_cpu > self . _AVG_CPU_UTIL_PCT_PER_WORKER_MAXIMUM : bottleneck = self . pipeline_ops [ op_id ] suggestion = "{} has high CPU utilization per worker of {}%" . format ( self . pipeline_ops [ op_id ] , wkr_cpu ) suggestion += " Try increasing num_parallel_workers above {}." . format ( self . num_workers [ op_id ] ) elif wkr_cpu < self . _AVG_CPU_UTIL_PCT_PER_WORKER_MINIMUM : in_op_id = self . __get_non_inline_child_recur ( op_id ) in_q_usage = self . queue_utilization_pct [ in_op_id ] if in_op_id != self . op_id_not_exist and ( in_q_usage < self . _IN_QUEUE_UTIL_PCT_MAXIMUM or out_q - in_q_usage > self . _IN_OUT_QUEUE_UTIL_PCT_DIFF_MAXIMUM ) : bottleneck = self . pipeline_ops [ op_id ] suggestion = "{} has low CPU utilization per worker of {}%" . format ( self . pipeline_ops [ op_id ] , wkr_cpu ) suggestion += " and abnormal queue usage. Try increasing prefetch_size." return [ bottleneck ] , [ suggestion ]