!31554 fix some warning of the mindspore.
Merge pull request !31554 from liuchuting/fix_warning
This commit is contained in:
commit
219b0c9e77
|
@ -260,7 +260,6 @@ void ProfilingManager::QueryHashId(const int32_t &device_id, const std::string &
|
|||
|
||||
*hash_id = hash_data.hashId;
|
||||
}
|
||||
|
||||
} // namespace ascend
|
||||
} // namespace device
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -84,7 +84,6 @@ class ProfilingManager {
|
|||
private:
|
||||
uint32_t device_id_;
|
||||
MsprofCallback prof_cb_;
|
||||
aclprofConfig *acl_config_;
|
||||
ProfilingState cur_state_;
|
||||
std::string profiling_path_;
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ static std::map<string, uint32_t> OpFormat2Index{{kOpFormat_DEFAULT, 1},
|
|||
{kOpFormat_DHWNC, 20},
|
||||
{kOpFormat_DHWCN, 21}};
|
||||
|
||||
bool ProfilingReporter::CheckStreamTaskValid() {
|
||||
bool ProfilingReporter::CheckStreamTaskValid() const {
|
||||
if (cnode_list_.size() != stream_ids_.size() || cnode_list_.size() != task_ids_.size()) {
|
||||
MS_LOG(ERROR) << "CNode size is not equal stream size or not equal task size, "
|
||||
"can not support to report profiling data. CNode size is "
|
||||
|
@ -75,9 +75,9 @@ void ProfilingReporter::ReportTasks() {
|
|||
KernelType kernel_type = AnfAlgo::GetKernelType(node);
|
||||
auto stream_id = stream_ids_[task_index];
|
||||
auto task_id = task_ids_[task_index];
|
||||
(void)ReportTask(node, stream_id, task_id, kernel_type);
|
||||
(void)ReportNode(node, stream_id, task_id, MSPROF_GE_TENSOR_TYPE_INPUT);
|
||||
(void)ReportNode(node, stream_id, task_id, MSPROF_GE_TENSOR_TYPE_OUTPUT);
|
||||
ReportTask(node, stream_id, task_id, kernel_type);
|
||||
ReportNode(node, stream_id, task_id, MSPROF_GE_TENSOR_TYPE_INPUT);
|
||||
ReportNode(node, stream_id, task_id, MSPROF_GE_TENSOR_TYPE_OUTPUT);
|
||||
|
||||
++task_index;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void ProfilingReporter::ReportStepPoint(const std::vector<std::shared_ptr<StepPo
|
|||
MS_EXCEPTION_IF_NULL(kernel_mod);
|
||||
// The tag of this function should report all tags, it will be saved to ts_track.data.<device_id>.slice_<index>
|
||||
// The first step index set to 1, here keep same with ge
|
||||
rtProfilerTraceEx(1, graph_id_, point->tag(), kernel_mod->stream());
|
||||
(void)rtProfilerTraceEx(1, graph_id_, point->tag(), kernel_mod->stream());
|
||||
|
||||
MS_LOG(INFO) << "Report step point, graph id: " << graph_id_ << ", op name: " << point->op_name()
|
||||
<< ", stream id: " << GetStreamId(op_name) << ", task id: " << GetTaskId(op_name)
|
||||
|
@ -133,15 +133,15 @@ const CNodePtr ProfilingReporter::GetCNode(const std::string &name) const {
|
|||
|
||||
uint32_t ProfilingReporter::GetStreamId(const string &node_name) {
|
||||
auto index = node_name_index_map_[node_name];
|
||||
return stream_ids_[index];
|
||||
return stream_ids_[(uint32_t)index];
|
||||
}
|
||||
|
||||
uint32_t ProfilingReporter::GetTaskId(const string &node_name) {
|
||||
auto index = node_name_index_map_[node_name];
|
||||
return task_ids_[index];
|
||||
return task_ids_[(uint32_t)index];
|
||||
}
|
||||
|
||||
void ProfilingReporter::ReportData(int32_t device_id, unsigned char *data, size_t data_size, const string &tag_name) {
|
||||
void ProfilingReporter::ReportData(uint32_t device_id, unsigned char *data, size_t data_size, const string &tag_name) {
|
||||
ReporterData report_data{};
|
||||
report_data.deviceId = device_id;
|
||||
report_data.data = data;
|
||||
|
@ -165,7 +165,7 @@ void ProfilingReporter::ConstructNodeNameIndexMap() {
|
|||
size_t task_index = 0;
|
||||
for (const auto &node : cnode_list_) {
|
||||
MS_EXCEPTION_IF_NULL(node);
|
||||
node_name_index_map_.insert(pair<string, uint32_t>(node->fullname_with_scope(), task_index));
|
||||
node_name_index_map_.insert(pair<string, int>(node->fullname_with_scope(), task_index));
|
||||
++task_index;
|
||||
}
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ void ProfilingReporter::ReportTask(const CNodePtr &node, const uint32_t stream_i
|
|||
KernelType kernel_type) {
|
||||
MsprofGeProfTaskData task_info{};
|
||||
task_info.taskType = static_cast<uint32_t>(KernelType2TaskTypeEnum[kernel_type]);
|
||||
(void)SetAlternativeValue(&task_info.opName, MSPROF_MIX_DATA_STRING_LEN, node->fullname_with_scope(), device_id_);
|
||||
(void)SetAlternativeValue(&task_info.opType, MSPROF_GE_OP_TYPE_LEN, common::AnfAlgo::GetCNodeName(node), device_id_);
|
||||
SetAlternativeValue(&task_info.opName, MSPROF_MIX_DATA_STRING_LEN, node->fullname_with_scope(), device_id_);
|
||||
SetAlternativeValue(&task_info.opType, MSPROF_GE_OP_TYPE_LEN, common::AnfAlgo::GetCNodeName(node), device_id_);
|
||||
// Note: Currently, the profiler supports only static shapes.
|
||||
task_info.shapeType = static_cast<uint32_t>(MSPROF_GE_SHAPE_TYPE_STATIC);
|
||||
task_info.blockDims = GetBlockDim(node);
|
||||
|
@ -194,7 +194,7 @@ void ProfilingReporter::ReportTask(const CNodePtr &node, const uint32_t stream_i
|
|||
task_info.timeStamp = 0;
|
||||
task_info.threadId = 0;
|
||||
|
||||
(void)ReportData(device_id_, reinterpret_cast<unsigned char *>(&task_info), sizeof(task_info), "task_desc_info");
|
||||
ReportData(device_id_, reinterpret_cast<unsigned char *>(&task_info), sizeof(task_info), "task_desc_info");
|
||||
}
|
||||
|
||||
void ProfilingReporter::ReportNode(const CNodePtr &node, uint32_t stream_id, uint32_t task_id, uint32_t tensor_type) {
|
||||
|
@ -210,15 +210,15 @@ void ProfilingReporter::ReportNode(const CNodePtr &node, uint32_t stream_id, uin
|
|||
const size_t batch_size = total_size / MSPROF_GE_TENSOR_DATA_NUM;
|
||||
for (size_t i = 0U; i < batch_size; i++) {
|
||||
MsprofGeProfTensorData tensor_info{};
|
||||
(void)BuildProfTensorDataCommon(&tensor_info, stream_id, task_id);
|
||||
BuildProfTensorDataCommon(&tensor_info, stream_id, task_id);
|
||||
tensor_info.tensorNum = MSPROF_GE_TENSOR_DATA_NUM;
|
||||
for (size_t j = 0U; j < MSPROF_GE_TENSOR_DATA_NUM; j++) {
|
||||
size_t cur_index = i * MSPROF_GE_TENSOR_DATA_NUM + j;
|
||||
MsprofGeTensorData tensor_data{};
|
||||
(void)BuildTensorData(&tensor_data, node, cur_index, tensor_type);
|
||||
BuildTensorData(&tensor_data, node, cur_index, tensor_type);
|
||||
tensor_info.tensorData[j] = tensor_data;
|
||||
}
|
||||
(void)ReportData(device_id_, reinterpret_cast<unsigned char *>(&tensor_info), sizeof(tensor_info), tag_name);
|
||||
ReportData(device_id_, reinterpret_cast<unsigned char *>(&tensor_info), sizeof(tensor_info), tag_name);
|
||||
}
|
||||
|
||||
size_t remain_size = total_size % MSPROF_GE_TENSOR_DATA_NUM;
|
||||
|
@ -227,15 +227,15 @@ void ProfilingReporter::ReportNode(const CNodePtr &node, uint32_t stream_id, uin
|
|||
}
|
||||
|
||||
MsprofGeProfTensorData tensor_info{};
|
||||
(void)BuildProfTensorDataCommon(&tensor_info, stream_id, task_id);
|
||||
BuildProfTensorDataCommon(&tensor_info, stream_id, task_id);
|
||||
tensor_info.tensorNum = remain_size;
|
||||
for (size_t i = 0U; i < remain_size; ++i) {
|
||||
MsprofGeTensorData tensor_data{};
|
||||
size_t cur_index = batch_size * MSPROF_GE_TENSOR_DATA_NUM + i;
|
||||
(void)BuildTensorData(&tensor_data, node, cur_index, tensor_type);
|
||||
BuildTensorData(&tensor_data, node, cur_index, tensor_type);
|
||||
tensor_info.tensorData[i] = tensor_data;
|
||||
}
|
||||
(void)ReportData(device_id_, reinterpret_cast<unsigned char *>(&tensor_info), sizeof(tensor_info), tag_name);
|
||||
ReportData(device_id_, reinterpret_cast<unsigned char *>(&tensor_info), sizeof(tensor_info), tag_name);
|
||||
}
|
||||
|
||||
void ProfilingReporter::BuildProfTensorDataCommon(MsprofGeProfTensorData *tensor_info, uint32_t stream_id,
|
||||
|
@ -269,7 +269,7 @@ void ProfilingReporter::BuildTensorData(MsprofGeTensorData *tensor_data, const C
|
|||
|
||||
tensor_data->format = OpFormat2Index[data_format];
|
||||
auto shape_size = std::min(static_cast<uint64_t>(MSPROF_GE_TENSOR_DATA_SHAPE_LEN), shape.size());
|
||||
std::copy(shape.begin(), shape.begin() + shape_size, tensor_data->shape);
|
||||
(void)std::copy(shape.begin(), shape.begin() + shape_size, tensor_data->shape);
|
||||
}
|
||||
} // namespace ascend
|
||||
} // namespace device
|
||||
|
|
|
@ -71,14 +71,14 @@ class ProfilingReporter {
|
|||
vector<uint32_t> task_ids_;
|
||||
map<string, int> node_name_index_map_;
|
||||
|
||||
bool CheckStreamTaskValid();
|
||||
bool CheckStreamTaskValid() const;
|
||||
static uint32_t GetBlockDim(const CNodePtr &node);
|
||||
void ConstructNodeNameIndexMap();
|
||||
uint32_t GetStreamId(const string &node_name);
|
||||
uint32_t GetTaskId(const string &node_name);
|
||||
const CNodePtr GetCNode(const std::string &name) const;
|
||||
|
||||
void ReportData(int32_t device_id, unsigned char *data, size_t data_size, const std::string &tag_name);
|
||||
void ReportData(uint32_t device_id, unsigned char *data, size_t data_size, const std::string &tag_name);
|
||||
void ReportTask(const CNodePtr &node, uint32_t stream_id, uint32_t task_id, KernelType kernel_type);
|
||||
void ReportNode(const CNodePtr &node, uint32_t stream_id, uint32_t task_id, uint32_t tensor_type);
|
||||
void BuildProfTensorDataCommon(MsprofGeProfTensorData *tensor_info, uint32_t stream_id, uint32_t task_id);
|
||||
|
@ -97,7 +97,7 @@ class ProfilingReporter {
|
|||
} else {
|
||||
property->type = static_cast<uint8_t>(MSPROF_MIX_DATA_STRING);
|
||||
uint64_t hash_id;
|
||||
(void)ProfilingManager::GetInstance().QueryHashId(device_id, value, &hash_id);
|
||||
ProfilingManager::GetInstance().QueryHashId(device_id, value, &hash_id);
|
||||
property->data.hashId = hash_id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ ProfilingTraceInfo ProfilingUtils::GenerateProfilingTrace(const session::KernelG
|
|||
auto set_string_converter = [](const std::set<std::string> &str_set) {
|
||||
std::ostringstream stream;
|
||||
stream << "(";
|
||||
std::copy(str_set.begin(), str_set.end(), std::ostream_iterator<std::string>(stream, ","));
|
||||
(void)std::copy(str_set.begin(), str_set.end(), std::ostream_iterator<std::string>(stream, ","));
|
||||
stream << ")";
|
||||
return stream.str();
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ void ProfilingUtils::GetTraceHccl(const session::KernelGraph &kernel_graph,
|
|||
for (const auto &node : kernel_graph.execution_order()) {
|
||||
if (common::AnfAlgo::IsCommunicationOp(node)) {
|
||||
MS_EXCEPTION_IF_NULL(node);
|
||||
profiling_trace->trace_custom_node.insert(node->fullname_with_scope());
|
||||
(void)profiling_trace->trace_custom_node.insert(node->fullname_with_scope());
|
||||
MS_LOG(INFO) << "Profiling graph:" << kernel_graph.graph_id() << " Get hccl node:" << node->fullname_with_scope();
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void ProfilingUtils::GetCNodeOutputRealNode(const std::string &node_name, const
|
|||
continue;
|
||||
}
|
||||
if (common::AnfAlgo::GetCNodeName(prev_cnode.first) == node_name) {
|
||||
getnext_outputs->insert(cnode->fullname_with_scope());
|
||||
(void)getnext_outputs->insert(cnode->fullname_with_scope());
|
||||
MS_LOG(INFO) << "Profiling graph:" << kernel_graph.graph_id()
|
||||
<< " Find GetNext Output CNode:" << cnode->fullname_with_scope();
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void ProfilingUtils::GetTraceBpEnd(const session::KernelGraph &kernel_graph, con
|
|||
if (!bp_point_str.empty()) {
|
||||
MS_LOG(INFO) << "Profiling graph:" << kernel_graph.graph_id()
|
||||
<< " Get bp_point from profiling_option:" << bp_point_str;
|
||||
trace_info->trace_bp_end.insert(bp_point_str);
|
||||
(void)trace_info->trace_bp_end.insert(bp_point_str);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ void ProfilingUtils::GetTraceBpEnd(const session::KernelGraph &kernel_graph, con
|
|||
auto input_node_with_index = common::AnfAlgo::GetPrevNodeOutput(*iter, i);
|
||||
auto input_node = input_node_with_index.first;
|
||||
MS_EXCEPTION_IF_NULL(input_node);
|
||||
ar_input_node_names.insert(input_node->fullname_with_scope());
|
||||
(void)ar_input_node_names.insert(input_node->fullname_with_scope());
|
||||
}
|
||||
// start from previous node
|
||||
++iter;
|
||||
|
@ -224,7 +224,7 @@ void ProfilingUtils::GetTraceIterEnd(const session::KernelGraph &kernel_graph, P
|
|||
if (common::AnfAlgo::HasNodeAttr(kAttrProfilingIterEnd, node)) {
|
||||
MS_LOG(INFO) << "Profiling graph:" << kernel_graph.graph_id()
|
||||
<< " Found PROFILING_ITER_END:" << node->fullname_with_scope();
|
||||
trace_info->trace_iter_end.insert(node->fullname_with_scope());
|
||||
(void)trace_info->trace_iter_end.insert(node->fullname_with_scope());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ void ProfilingUtils::GetTraceIterEnd(const session::KernelGraph &kernel_graph, P
|
|||
if (last_kernel_name.empty()) {
|
||||
MS_LOG(WARNING) << "Profiling graph:" << kernel_graph.graph_id() << " No TBE or AKG or HCCL op found in graph";
|
||||
} else {
|
||||
trace_info->trace_iter_end.insert(last_kernel_name);
|
||||
(void)trace_info->trace_iter_end.insert(last_kernel_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ NotNull<CNodePtr> ProfilingUtils::CreateProfilingCNode(const ProfilingContent &p
|
|||
abstract::AbstractBasePtr type_none_abstract = std::make_shared<abstract::AbstractNone>();
|
||||
auto primitive = std::make_shared<Primitive>(ProfilingUtils::kProfiling);
|
||||
std::vector<AnfNodePtr> inputs;
|
||||
inputs.emplace_back(NewValueNode(primitive));
|
||||
(void)inputs.emplace_back(NewValueNode(primitive));
|
||||
CNodePtr cnode_ptr = graph_ptr->NewCNode(inputs);
|
||||
MS_EXCEPTION_IF_NULL(cnode_ptr);
|
||||
AnfAlgo::SetSelectKernelBuildInfo(selected_kernel_builder.Build(), cnode_ptr.get());
|
||||
|
@ -274,9 +274,9 @@ void ProfilingUtils::SaveProfilingPoint(uint32_t graph_id, const std::string &no
|
|||
std::shared_ptr<StepPointDesc> point_desc_ptr = std::make_shared<StepPointDesc>(node_name, point_id);
|
||||
auto iter = graph_point_.find(graph_id);
|
||||
if (iter == graph_point_.end()) {
|
||||
graph_point_.emplace(graph_id, std::vector<std::shared_ptr<StepPointDesc>>{point_desc_ptr});
|
||||
(void)graph_point_.emplace(graph_id, std::vector<std::shared_ptr<StepPointDesc>>{point_desc_ptr});
|
||||
} else {
|
||||
iter->second.emplace_back(point_desc_ptr);
|
||||
(void)iter->second.emplace_back(point_desc_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ void ProfilingUtils::InsertProfilingTraceFp(const mindspore::AnfNodePtr &anf_nod
|
|||
InsertProfilingTraceJobId(anf_node, graph_ptr, kernel_list);
|
||||
ProfilingContent fp_profiling_content = {false, kProfilingFpStartLogId, 0};
|
||||
auto fp_profiling_node = CreateProfilingCNodeWithStream(anf_node, fp_profiling_content, graph_ptr);
|
||||
kernel_list->emplace_back(fp_profiling_node);
|
||||
(void)kernel_list->emplace_back(fp_profiling_node);
|
||||
// insert ProfDesc
|
||||
SaveProfilingPoint(graph_ptr->graph_id(), anf_node->fullname_with_scope(), kProfilingFpStartLogId);
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void ProfilingUtils::InsertProfilingTraceJobId(const AnfNodePtr &anf_node, NotNu
|
|||
auto job_id = ProfilingManager::GetInstance().GetJobId();
|
||||
ProfilingContent job_profiling_context = {false, job_id, 0};
|
||||
auto job_profiling_node = CreateProfilingCNodeWithStream(anf_node, job_profiling_context, graph_ptr);
|
||||
kernel_list->emplace_back(job_profiling_node);
|
||||
(void)kernel_list->emplace_back(job_profiling_node);
|
||||
}
|
||||
|
||||
CNodePtr ProfilingUtils::CreateProfilingCNodeWithStream(const mindspore::AnfNodePtr &anf_node,
|
||||
|
@ -327,12 +327,12 @@ void ProfilingUtils::InsertProfilingCustomOp(const AnfNodePtr &anf_node, const P
|
|||
auto custom_point_id = kDouble * custom_node_index_;
|
||||
ProfilingContent front_profiling_content = {false, custom_point_id, 0};
|
||||
CNodePtr front_node = CreateProfilingCNodeWithStream(anf_node, front_profiling_content, graph_ptr);
|
||||
kernel_list->insert(kernel_list->end() - 1, front_node);
|
||||
(void)kernel_list->insert(kernel_list->end() - 1, front_node);
|
||||
SaveProfilingPoint(graph_ptr->graph_id(), anf_node->fullname_with_scope(), custom_point_id);
|
||||
|
||||
ProfilingContent back_profiling_content = {false, custom_point_id + 1, 0};
|
||||
CNodePtr back_node = CreateProfilingCNodeWithStream(anf_node, back_profiling_content, graph_ptr);
|
||||
kernel_list->insert(kernel_list->end(), back_node);
|
||||
(void)kernel_list->insert(kernel_list->end(), back_node);
|
||||
SaveProfilingPoint(graph_ptr->graph_id(), anf_node->fullname_with_scope(), custom_point_id + 1);
|
||||
++custom_node_index_;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void ProfilingUtils::InsertProfilingTraceBpEnd(const AnfNodePtr &anf_node,
|
|||
MS_LOG(INFO) << "Profiling graph:" << graph_ptr->graph_id() << " Match BpEnd:" << node_name;
|
||||
ProfilingContent bp_end_profiling_content = {false, kProfilingBpEndLogId, 0};
|
||||
CNodePtr bp_end_node = CreateProfilingCNodeWithStream(anf_node, bp_end_profiling_content, graph_ptr);
|
||||
kernel_list->emplace_back(bp_end_node);
|
||||
(void)kernel_list->emplace_back(bp_end_node);
|
||||
SaveProfilingPoint(graph_ptr->graph_id(), node_name, kProfilingBpEndLogId);
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ void ProfilingUtils::InsertProfilingTraceIterEnd(const AnfNodePtr &anf_node,
|
|||
MS_LOG(INFO) << "Profiling graph:" << graph_ptr->graph_id() << " Match IterEnd:" << full_scope_name;
|
||||
ProfilingContent iter_end_profiling_content = {true, kProfilingIterEndLogId, 0};
|
||||
auto iter_end_kernel_ptr = CreateProfilingCNodeWithStream(anf_node, iter_end_profiling_content, graph_ptr);
|
||||
kernel_list->emplace_back(iter_end_kernel_ptr);
|
||||
(void)kernel_list->emplace_back(iter_end_kernel_ptr);
|
||||
SaveProfilingPoint(graph_ptr->graph_id(), full_scope_name, kProfilingIterEndLogId);
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ void ProfilingUtils::ReportProfilingData(const std::vector<uint32_t> &task_ids,
|
|||
void ProfilingUtils::SetReportProfilingData(const std::vector<uint32_t> &task_ids,
|
||||
const std::vector<uint32_t> &stream_ids, uint32_t graph_id) {
|
||||
GraphProfilingData report_data = {task_ids, stream_ids, graph_id};
|
||||
report_data_.emplace_back(report_data);
|
||||
(void)report_data_.emplace_back(report_data);
|
||||
}
|
||||
} // namespace ascend
|
||||
} // namespace device
|
||||
|
|
|
@ -38,19 +38,21 @@ class AscendProfiler : public Profiler {
|
|||
void Start();
|
||||
bool GetProfilingEnableFlag() const { return enable_flag_; }
|
||||
std::string GetProfilingOptions() const { return profiling_options_; }
|
||||
void SaveProfileData() { return; }
|
||||
void ClearInst() { return; }
|
||||
uint64_t GetOptionsMask() const;
|
||||
aclprofAicoreMetrics GetAicMetrics() const;
|
||||
void Finalize() const;
|
||||
bool IsInitialized() { return init_flag_; }
|
||||
bool IsInitialized() const { return init_flag_; }
|
||||
void ReportErrorMessage() const;
|
||||
|
||||
protected:
|
||||
void SaveProfileData() { return; }
|
||||
void ClearInst() { return; }
|
||||
|
||||
private:
|
||||
static std::shared_ptr<AscendProfiler> ascend_profiler_;
|
||||
std::string profiling_options_;
|
||||
uint32_t device_id_;
|
||||
aclprofConfig *acl_config_;
|
||||
uint32_t device_id_ = 0;
|
||||
aclprofConfig *acl_config_{nullptr};
|
||||
};
|
||||
} // namespace ascend
|
||||
} // namespace profiler
|
||||
|
|
|
@ -98,7 +98,7 @@ float CPUProfiler::SetRuntimeEnd(const std::string op_name, const uint64_t stop_
|
|||
MS_LOG(EXCEPTION) << "Op " << op_name << " start time thread id must be equal to end thread id.";
|
||||
}
|
||||
}
|
||||
iter->second.start_duration.emplace_back(iter->second.tmp_start_duration);
|
||||
(void)iter->second.start_duration.emplace_back(iter->second.tmp_start_duration);
|
||||
op_time_elapsed = iter->second.tmp_start_duration.duration;
|
||||
}
|
||||
return op_time_elapsed;
|
||||
|
|
|
@ -58,7 +58,7 @@ uint64_t Profiler::GetRealTimeStamp() const {
|
|||
int64_t ts = kUSecondInSecond * static_cast<int64_t>(tv.tv_sec);
|
||||
ts += static_cast<int64_t>(tv.tv_usec);
|
||||
// us timestamp
|
||||
return ts;
|
||||
return (uint64_t)ts;
|
||||
}
|
||||
|
||||
void Profiler::SetRunTimeData(const std::string &op_name, const float time_elapsed) {
|
||||
|
@ -82,7 +82,7 @@ void Profiler::RecordOneStepStartEndInfo() {
|
|||
std::lock_guard<std::mutex> locker(record_mutex_);
|
||||
std::string step_end_op_name;
|
||||
std::string op_type = "GetNext";
|
||||
uint32_t vector_size = step_start_end_info_vector_.size();
|
||||
uint32_t vector_size = (uint32_t)step_start_end_info_vector_.size();
|
||||
step_start_end_info_.iter_start_op_name = step_start_end_info_vector_[0];
|
||||
step_start_end_info_.fp_start_op_name = step_start_end_info_vector_[0];
|
||||
|
||||
|
@ -123,8 +123,8 @@ void Profiler::RecordOneStepStartEndInfo() {
|
|||
}
|
||||
step_start_end_info_.iter_end_op_name = step_start_end_info_vector_[iter_end_op_index];
|
||||
// Delete the operator of the current step.
|
||||
step_start_end_info_vector_.erase(step_start_end_info_vector_.begin(),
|
||||
step_start_end_info_vector_.begin() + iter_end_op_index + 1);
|
||||
(void)step_start_end_info_vector_.erase(step_start_end_info_vector_.begin(),
|
||||
step_start_end_info_vector_.begin() + iter_end_op_index + 1);
|
||||
} else {
|
||||
step_start_end_info_.fp_start_op_name = step_start_end_info_vector_[1];
|
||||
step_start_end_info_.iter_end_op_name = step_start_end_info_vector_[step_start_end_info_vector_.size() - 1];
|
||||
|
|
|
@ -100,7 +100,7 @@ class Profiler {
|
|||
std::pair<double, double> single_op_launch_start_time_end_time_;
|
||||
bool enable_flag_ = false;
|
||||
bool has_find = false;
|
||||
uint32_t iter_end_op_index;
|
||||
uint32_t iter_end_op_index = 0;
|
||||
std::string profile_data_path_;
|
||||
std::unordered_map<std::string, OpInfo> op_info_map_;
|
||||
OneStepStartEndInfo step_start_end_info_;
|
||||
|
|
Loading…
Reference in New Issue