From c9581280c7bb67ab7283c122182375e417fba5fb Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 11:23:38 +0800 Subject: [PATCH] [BugFix] Reset historical io stats after catch io profile (backport #42517) (#42570) Signed-off-by: zhangqiang Co-authored-by: zhangqiang --- be/src/io/io_profiler.cpp | 5 +++++ be/src/io/io_profiler.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/be/src/io/io_profiler.cpp b/be/src/io/io_profiler.cpp index c1dd24508b648..b5da1c5ee3dd8 100644 --- a/be/src/io/io_profiler.cpp +++ b/be/src/io/io_profiler.cpp @@ -106,6 +106,10 @@ class IOStatEntryHash { static std::mutex _io_stats_mutex; static std::unordered_set _io_stats; +bool IOProfiler::is_empty() { + return _io_stats.empty(); +} + void IOProfiler::reset() { uint32_t old_mode = _mode.load(); if (old_mode != IOMode::IOMODE_NONE) { @@ -260,6 +264,7 @@ std::string IOProfiler::profile_and_get_topn_stats_str(const std::string& mode, ss << it << "\n"; } } + IOProfiler::reset(); return ss.str(); } diff --git a/be/src/io/io_profiler.h b/be/src/io/io_profiler.h index 9e695e6e54a19..a3689182f88ca 100644 --- a/be/src/io/io_profiler.h +++ b/be/src/io/io_profiler.h @@ -54,6 +54,8 @@ class IOProfiler { static IOStatEntry* get_context(); static void clear_context(); + static bool is_empty(); + class Scope { public: Scope() = delete;