From 8e680b068ad4d57db3701a953943451959a8db76 Mon Sep 17 00:00:00 2001 From: Dmitry Novik Date: Mon, 25 Oct 2021 16:53:23 +0300 Subject: [PATCH] Add comment with fix explanation --- src/Common/ProgressIndication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Common/ProgressIndication.cpp b/src/Common/ProgressIndication.cpp index 5a3f8cfc350..db1daaac415 100644 --- a/src/Common/ProgressIndication.cpp +++ b/src/Common/ProgressIndication.cpp @@ -122,6 +122,9 @@ ProgressIndication::MemoryUsage ProgressIndication::getMemoryUsage() const [](MemoryUsage const & acc, auto const & host_data) { UInt64 host_usage = 0; + // In ProfileEvents packets thread id 0 specifies common profiling information + // for all threads executing current query on specific host. So instead of summing per thread + // memory consumption it's enough to look for data with thread id 0. if (auto it = host_data.second.find(ZERO); it != host_data.second.end()) host_usage = it->second.memory_usage; return MemoryUsage{.total = acc.total + host_usage, .max = std::max(acc.max, host_usage)};