This is an automated email from the ASF dual-hosted git repository.
wangzhen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new eefa26b79d [GLUTEN-9994][VL] Log velox memory usage stats when
VeloxMemoryManager is shrinking (#10000)
eefa26b79d is described below
commit eefa26b79d11d2d7e6a302627e0976ab21f74962
Author: Zhen Wang <[email protected]>
AuthorDate: Thu Jun 19 17:10:21 2025 +0800
[GLUTEN-9994][VL] Log velox memory usage stats when VeloxMemoryManager is
shrinking (#10000)
* [GLUTEN-9994][VL] Log velox memory usage stats when VeloxMemoryManager is
shrinking
* fmt
---
cpp/velox/memory/VeloxMemoryManager.cc | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/cpp/velox/memory/VeloxMemoryManager.cc
b/cpp/velox/memory/VeloxMemoryManager.cc
index 8ef7620984..f9ad1b3d19 100644
--- a/cpp/velox/memory/VeloxMemoryManager.cc
+++ b/cpp/velox/memory/VeloxMemoryManager.cc
@@ -294,12 +294,27 @@ MemoryUsageStats collectGlutenAllocatorMemoryUsageStats(
return stats;
}
+void logMemoryUsageStats(MemoryUsageStats stats, const std::string& name,
const std::string& logPrefix) {
+ VLOG(2) << logPrefix << "+- " << name
+ << " (used: " << velox::succinctBytes(stats.current())
+ << ", peak: " << velox::succinctBytes(stats.peak()) << ")";
+ if (stats.children_size() > 0) {
+ for (auto it = stats.children().begin(); it != stats.children().end();
++it) {
+ logMemoryUsageStats(it->second, it->first, logPrefix + " ");
+ }
+ }
+}
+
int64_t shrinkVeloxMemoryPool(velox::memory::MemoryManager* mm,
velox::memory::MemoryPool* pool, int64_t size) {
std::string poolName{pool->root()->name() + "/" + pool->name()};
std::string logPrefix{"Shrink[" + poolName + "]: "};
VLOG(2) << logPrefix << "Trying to shrink " << size << " bytes of data...";
VLOG(2) << logPrefix << "Pool has reserved " << pool->usedBytes() << "/" <<
pool->root()->reservedBytes() << "/"
<< pool->root()->capacity() << "/" << pool->root()->maxCapacity() <<
" bytes.";
+ VLOG(2) << logPrefix << "Velox memory usage stats...";
+ if (VLOG_IS_ON(2)) {
+ logMemoryUsageStats(collectVeloxMemoryUsageStats(pool), poolName,
logPrefix);
+ }
VLOG(2) << logPrefix << "Shrinking...";
auto shrunken = mm->arbitrator()->shrinkCapacity(pool, 0);
VLOG(2) << logPrefix << shrunken << " bytes released from shrinking.";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]