diff --git a/ge/common/dump/dump_manager.cc b/ge/common/dump/dump_manager.cc index a6944fc6..ebe16fed 100644 --- a/ge/common/dump/dump_manager.cc +++ b/ge/common/dump/dump_manager.cc @@ -33,7 +33,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpManager &DumpManager::GetIn bool DumpManager::NeedDoDump(const DumpConfig &dump_config, DumpProperties &dump_properties) { if (dump_config.dump_status.empty() && dump_config.dump_debug.empty()) { - dump_properties_map_.emplace(kInferSessionId, dump_properties); + dump_properties_map_[kInferSessionId] = dump_properties; GELOGI("Dump does not open"); return false; } @@ -41,7 +41,7 @@ bool DumpManager::NeedDoDump(const DumpConfig &dump_config, DumpProperties &dump if ((dump_config.dump_status == kDumpoff || dump_config.dump_status == kDumpOFF) && dump_config.dump_debug == kDumpoff) { dump_properties.ClearDumpPropertyValue(); - dump_properties_map_.emplace(kInferSessionId, dump_properties); + dump_properties_map_[kInferSessionId] = dump_properties; return false; } if (dump_config.dump_status == kDumpOn && dump_config.dump_debug == kDumpOn) { diff --git a/tests/ut/ge/common/dump_manager_unittest.cc b/tests/ut/ge/common/dump_manager_unittest.cc index 50eabc4a..7a242997 100644 --- a/tests/ut/ge/common/dump_manager_unittest.cc +++ b/tests/ut/ge/common/dump_manager_unittest.cc @@ -16,6 +16,8 @@ #include +#define protected public +#define private public #include "common/dump/dump_manager.h" #include "common/debug/log.h" #include "common/ge_inner_error_codes.h" @@ -102,4 +104,13 @@ TEST_F(UTEST_dump_manager, is_dump_single_op_close_success) { auto dump = DumpManager::GetInstance().GetDumpProperties(0); DumpManager::GetInstance().RemoveDumpProperties(0); } + + TEST_F(UTEST_dump_manager, not_need_do_dump) { + DumpConfig dump_config; + dump_config.dump_status = "off"; + dump_config.dump_debug = "off"; + DumpProperties dump_properties; + bool ret = DumpManager::GetInstance().NeedDoDump(dump_config, dump_properties); + EXPECT_EQ(ret, false); + } } // namespace ge \ No newline at end of file