From 1260481b81b2ff53372cf09e26d316f10026f1f4 Mon Sep 17 00:00:00 2001 From: yuximiao Date: Wed, 24 Jun 2020 11:31:30 +0800 Subject: [PATCH] fix minddata wrong time tag --- mindinsight/profiler/analyser/minddata_analyser.py | 4 ++-- mindinsight/profiler/common/util.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mindinsight/profiler/analyser/minddata_analyser.py b/mindinsight/profiler/analyser/minddata_analyser.py index 1a0af02..76337e4 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 ee25bfc..02e8921 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}%' -- GitLab