Skip to content

Commit

Permalink
[BugFix] Reset historical io stats after catch io profile (backport #…
Browse files Browse the repository at this point in the history
…42517) (#42570)

Signed-off-by: zhangqiang <[email protected]>
Co-authored-by: zhangqiang <[email protected]>
  • Loading branch information
mergify[bot] and sevev authored Mar 14, 2024
1 parent 9c46ede commit c958128
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions be/src/io/io_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class IOStatEntryHash {
static std::mutex _io_stats_mutex;
static std::unordered_set<IOStatEntry, IOStatEntryHash> _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) {
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions be/src/io/io_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class IOProfiler {
static IOStatEntry* get_context();
static void clear_context();

static bool is_empty();

class Scope {
public:
Scope() = delete;
Expand Down

0 comments on commit c958128

Please sign in to comment.