This is an automated email from the ASF dual-hosted git repository.

yangzy 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 2648857494 [GLUTEN-9994][VL][FOLLOWUP] Use stringstream to construct 
velox memory usage stats log (#10052)
2648857494 is described below

commit 2648857494e5e00b0f0cafaddf129f20e7a52637
Author: Zhen Wang <[email protected]>
AuthorDate: Wed Jun 25 12:54:09 2025 +0800

    [GLUTEN-9994][VL][FOLLOWUP] Use stringstream to construct velox memory 
usage stats log (#10052)
---
 cpp/velox/memory/VeloxMemoryManager.cc | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/cpp/velox/memory/VeloxMemoryManager.cc 
b/cpp/velox/memory/VeloxMemoryManager.cc
index f9ad1b3d19..669a72eb62 100644
--- a/cpp/velox/memory/VeloxMemoryManager.cc
+++ b/cpp/velox/memory/VeloxMemoryManager.cc
@@ -294,13 +294,13 @@ 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()) << ")";
+void logMemoryUsageStats(MemoryUsageStats stats, const std::string& name, 
const std::string& logPrefix, std::stringstream& ss) {
+  ss << logPrefix << "+- " << name
+     << " (used: " << velox::succinctBytes(stats.current())
+     << ", peak: " <<  velox::succinctBytes(stats.peak()) << ")\n";
   if (stats.children_size() > 0) {
     for (auto it = stats.children().begin(); it != stats.children().end(); 
++it) {
-      logMemoryUsageStats(it->second, it->first, logPrefix + "   ");
+      logMemoryUsageStats(it->second, it->first, logPrefix + "   ", ss);
     }
   }
 }
@@ -311,9 +311,11 @@ int64_t 
shrinkVeloxMemoryPool(velox::memory::MemoryManager* mm, velox::memory::M
   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);
+    std::stringstream ss;
+    ss << logPrefix << "Velox memory usage stats:\n";
+    logMemoryUsageStats(collectVeloxMemoryUsageStats(pool), poolName, 
logPrefix, ss);
+    VLOG(2) << ss.str();
   }
   VLOG(2) << logPrefix << "Shrinking...";
   auto shrunken = mm->arbitrator()->shrinkCapacity(pool, 0);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to