From be56ef6efc4c5dc291ff63e1ba4b03928228d561 Mon Sep 17 00:00:00 2001 From: RobinGrosman Date: Mon, 29 Mar 2021 17:47:47 -0700 Subject: [PATCH] codex and clint fix for parallel_op.cc and cpu_sampling.cc --- .../minddata/dataset/engine/datasetops/parallel_op.cc | 1 + .../minddata/dataset/engine/perf/cpu_sampling.cc | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.cc index aa4f3a2605b..eb73a1cf4db 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.cc @@ -15,6 +15,7 @@ */ #include "minddata/dataset/engine/datasetops/parallel_op.h" +#include #include #include #include "minddata/dataset/engine/datasetops/dataset_op.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/perf/cpu_sampling.cc b/mindspore/ccsrc/minddata/dataset/engine/perf/cpu_sampling.cc index 4758fe8c27c..936d5f73dec 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/perf/cpu_sampling.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/perf/cpu_sampling.cc @@ -136,7 +136,8 @@ Status DeviceCpu::Collect(ExecutionTree *tree) { return Status::OK(); } Status DeviceCpu::Analyze(std::string *name, double *utilization, std::string *extra_message) { - *name = std::string("device_info"); + name->clear(); + name->append("device_info"); int total_samples = cpu_util_.size(); int sum = 0; // Only analyze the middle half of the samples @@ -357,7 +358,7 @@ Status OperatorCpu::Analyze(std::string *name, double *utilization, std::string // Starting and ending may be impacted by startup or ending pipeline activities int start_analyze = total_samples / 4; int end_analyze = total_samples - start_analyze; - double op_util; + double op_util = 0; *utilization = 0; // start loop from 0 was as don't want to analyze op -1 @@ -373,7 +374,8 @@ Status OperatorCpu::Analyze(std::string *name, double *utilization, std::string } if (op_util > *utilization) { *utilization = op_util; - *name = op_name[op_id]; + name->clear(); + name->append(op_name[op_id]); } extra_message->append(op_name[op_id] + " utiliization per thread: " + std::to_string(op_util) + "% (" + std::to_string(op_parallel_workers[op_id]) + " parallel_workers); "); @@ -508,7 +510,8 @@ Status ProcessCpu::Collect(ExecutionTree *tree) { } Status ProcessCpu::Analyze(std::string *name, double *utilization, std::string *extra_message) { - *name = std::string("process_info"); + name->clear(); + name->append("process_info"); int total_samples = process_util_.size(); int sum = 0; // Only analyze the middle half of the samples