diff --git a/mindinsight/profiler/analyser/minddata_analyser.py b/mindinsight/profiler/analyser/minddata_analyser.py index 1a0af02f4e4f9f958dbcb3c1dc047600f25946a3..76337e46d5c87f76a6e2816cf1e19534afa439ea 100644 --- a/mindinsight/profiler/analyser/minddata_analyser.py +++ b/mindinsight/profiler/analyser/minddata_analyser.py @@ -116,13 +116,13 @@ class MinddataAnalyser(BaseAnalyser): # op_info: 2: step num 3: cost time if op_info[1] == "0": get_time_list.append([int(op_info[2]), float(op_info[3])]) - total_cost += float(op_info[3]) + total_get += float(op_info[3]) elif op_info[1] == "1": push_time_list.append([int(op_info[2]), float(op_info[3])]) total_push += float(op_info[3]) elif op_info[1] == "2": total_time_list.append([int(op_info[2]), float(op_info[3])]) - total_get += float(op_info[3]) + total_cost += float(op_info[3]) elif op_info and op_info[0] == "1" and info_type in ["all", "queue"]: queue_size_list.append([int(op_info[2]), int(op_info[3])]) if op_info[1] == op_info[3]: diff --git a/mindinsight/profiler/common/util.py b/mindinsight/profiler/common/util.py index ee25bfc525efadf5e465ede71bc65b18f4ce310c..02e89216af8ec6b0321ac9561652c39c9255fb29 100644 --- a/mindinsight/profiler/common/util.py +++ b/mindinsight/profiler/common/util.py @@ -118,7 +118,10 @@ def get_summary_for_step_trace(average_info, header): def calculate_percent(partial, total): """Calculate percent value.""" - percent = round(partial / total * 100, 2) + if total: + percent = round(partial / total * 100, 2) + else: + percent = 0 return f'{percent}%'