!2154 fix profiling core dump when start profiling many times

Merge pull request !2154 from caifubi/fix-profiling-core-dump
pull/2154/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit b9e59f9de4

@ -169,7 +169,7 @@ bool ProfilingManager::StartupProfiling(uint32_t device_id) {
return true; return true;
} }
bool ProfilingManager::StopProfiling() const { bool ProfilingManager::StopProfiling() {
MS_LOG(INFO) << "StopProfiling"; MS_LOG(INFO) << "StopProfiling";
if (!IsProfiling()) { if (!IsProfiling()) {
MS_LOG(INFO) << "No need profiling. please export PROFILING_MODE and in train mode."; MS_LOG(INFO) << "No need profiling. please export PROFILING_MODE and in train mode.";
@ -184,8 +184,10 @@ bool ProfilingManager::StopProfiling() const {
int result = ProfMgrStop(prof_handle_); int result = ProfMgrStop(prof_handle_);
if (result != 0) { if (result != 0) {
MS_LOG(ERROR) << "ProfMgr stop return fail:" << result << "."; MS_LOG(ERROR) << "ProfMgr stop return fail:" << result << ".";
prof_handle_ = nullptr;
return false; return false;
} }
prof_handle_ = nullptr;
} }
return true; return true;

@ -39,7 +39,7 @@ class ProfilingManager {
uint64_t GetJobId() const; uint64_t GetJobId() const;
bool ReportProfilingData(const map<uint32_t, string> &op_taskId_map) const; bool ReportProfilingData(const map<uint32_t, string> &op_taskId_map) const;
bool StartupProfiling(uint32_t device_id); bool StartupProfiling(uint32_t device_id);
bool StopProfiling() const; bool StopProfiling();
inline bool IsProfiling() const { inline bool IsProfiling() const {
auto context = MsContext::GetInstance(); auto context = MsContext::GetInstance();

Loading…
Cancel
Save