Profiler memory could not collect data.

This commit is contained in:
liuchuting 2021-12-30 16:11:32 +08:00
parent 05237582c3
commit 2a9a968f7f
2 changed files with 2 additions and 2 deletions

View File

@ -46,6 +46,7 @@ void MemoryProfiling::StartMemoryProfiling() {
is_enabled_ = true;
if (NeedSaveMemoryProfiling()) {
SaveMemoryProfiling();
has_save_memory_data_ = true;
}
}
@ -143,7 +144,6 @@ void MemoryProfiling::SaveMemoryProfiling() {
}
handle.close();
has_save_memory_data_ = true;
MS_LOG(INFO) << "Start save memory profiling data to " << file << " end";
return;
}

View File

@ -115,7 +115,7 @@ class MemoryProfiling {
bool IsMemoryProfilingInitialized() const { return is_initialized_; }
bool IsMemoryProfilingEnabled() const { return is_enabled_; }
void SetMemoryProfilingInitialize(const std::string &profiling_options);
bool NeedSaveMemoryProfiling() { return (is_enabled_) && (!has_save_memory_data_); }
bool NeedSaveMemoryProfiling() { return (is_enabled_) && (graph_memory_.size() != 0) && (!has_save_memory_data_); }
void StartMemoryProfiling();
void StopMemoryProfiling();