[fix](memory) Independent count exec node memory profile (#22598)

Independent count exec node memory profile, after #22582
This commit is contained in:
Xinyi Zou
2023-08-06 10:56:31 +08:00
committed by GitHub
parent 1073a924c1
commit 96f42ca20a
12 changed files with 48 additions and 91 deletions

View File

@ -38,26 +38,6 @@ bvar::Adder<int64_t> g_memtracker_cnt("memtracker_cnt");
// Multiple groups are used to reduce the impact of locks.
std::vector<MemTracker::TrackerGroup> MemTracker::mem_tracker_pool(1000);
MemTracker::MemTracker(const std::string& label, RuntimeProfile* profile, MemTrackerLimiter* parent,
const std::string& profile_counter_name)
: _label(label) {
_consumption = std::make_shared<MemCounter>();
if (profile != nullptr) {
// By default, memory consumption is tracked via calls to consume()/release(), either to
// the tracker itself or to one of its descendents. Alternatively, a consumption metric
// can be specified, and then the metric's value is used as the consumption rather than
// the tally maintained by consume() and release(). A tcmalloc metric is used to track
// process memory consumption, since the process memory usage may be higher than the
// computed total memory (tcmalloc does not release deallocated memory immediately).
// Other consumption metrics are used in trackers below the process level to account
// for memory (such as free buffer pool buffers) that is not tracked by consume() and
// release().
_profile_counter =
profile->AddSharedHighWaterMarkCounter(profile_counter_name, TUnit::BYTES);
}
bind_parent(parent); // at the end
}
MemTracker::MemTracker(const std::string& label, MemTrackerLimiter* parent) : _label(label) {
_consumption = std::make_shared<MemCounter>();
bind_parent(parent);
@ -90,15 +70,6 @@ MemTracker::~MemTracker() {
}
}
void MemTracker::refresh_all_tracker_profile() {
for (unsigned i = 0; i < mem_tracker_pool.size(); ++i) {
std::lock_guard<std::mutex> l(mem_tracker_pool[i].group_lock);
for (auto tracker : mem_tracker_pool[i].trackers) {
tracker->refresh_profile_counter();
}
}
}
MemTracker::Snapshot MemTracker::make_snapshot() const {
Snapshot snapshot;
snapshot.label = _label;