Browse Source

!1574 回退 'Pull Request !1565 : profiling report data add lock'

From: @wqtshg
Reviewed-by: @xchu42,@ji_chen
Signed-off-by: @ji_chen
tags/v1.3.0
mindspore-ci-bot Gitee 3 years ago
parent
commit
88ec89298e
2 changed files with 1 additions and 8 deletions
  1. +1
    -2
      ge/common/profiling/profiling_manager.cc
  2. +0
    -6
      tests/ut/ge/profiling/ge_profiling_manager_unittest.cc

+ 1
- 2
ge/common/profiling/profiling_manager.cc View File

@@ -355,7 +355,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa
reporter_data.deviceId = device_id;
ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size());
GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;);
std::lock_guard<std::mutex> lock(mutex_);
for (size_t i = 0; i < index; ++i) {
reporter_data.data = (unsigned char *)data.c_str() + report_max_len * i;
reporter_data.dataLen = report_max_len;
@@ -376,7 +375,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa
reporter_data.dataLen = data.size();
ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size());
GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;);
std::lock_guard<std::mutex> lock(mutex_);
cb_ret = CallMsprofReport(reporter_data);
GE_IF_BOOL_EXEC(cb_ret != 0, GELOGE(cb_ret, "Reporter data [%s] failed, ret:%d", tag_name.c_str(), cb_ret);
return;);


+ 0
- 6
tests/ut/ge/profiling/ge_profiling_manager_unittest.cc View File

@@ -78,9 +78,3 @@ TEST_F(UtestGeProfilinganager, plungin_init_) {
EXPECT_EQ(ret, INTERNAL_ERROR);
ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr;
}

TEST_F(UtestGeProfilinganager, report_data_) {
std::string data = "ge is better than tensorflow.";
std::string tag_name = "fmk";
ProfilingManager::Instance().ReportData(0, data, tag_name);
}

Loading…
Cancel
Save