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

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 00099eef830 branch-4.0: [enhancement](memory) add jvm information into 
memory profile page in BE #57917 (#57928)
00099eef830 is described below

commit 00099eef830382663cb29448fcb357a91780c87f
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 13 10:01:53 2025 +0800

    branch-4.0: [enhancement](memory) add jvm information into memory profile 
page in BE #57917 (#57928)
    
    Cherry-picked from #57917
    
    Co-authored-by: yiguolei <[email protected]>
---
 be/src/runtime/memory/memory_profile.cpp | 18 +++++++++++++++++-
 be/src/runtime/memory/memory_profile.h   |  4 ++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/memory/memory_profile.cpp 
b/be/src/runtime/memory/memory_profile.cpp
index 217fcfc25e7..42898a9f50a 100644
--- a/be/src/runtime/memory/memory_profile.cpp
+++ b/be/src/runtime/memory/memory_profile.cpp
@@ -72,6 +72,9 @@ void MemoryProfile::init_memory_overview_counter() {
             tasks_memory_overview_profile->create_child("Details", true, 
false);
     RuntimeProfile* global_memory_overview_profile =
             tracked_memory_profile->create_child("GlobalMemory", true, false);
+
+    RuntimeProfile* jvm_memory_overview_profile =
+            tracked_memory_profile->create_child("JvmMemory", true, false);
     RuntimeProfile* metadata_memory_overview_profile =
             tracked_memory_profile->create_child("MetadataMemory", true, 
false);
     RuntimeProfile* cache_memory_overview_profile =
@@ -101,13 +104,17 @@ void MemoryProfile::init_memory_overview_counter() {
     _jemalloc_metadata_usage_counter =
             
jemalloc_memory_details_profile->AddHighWaterMarkCounter("Metadata", 
TUnit::BYTES);
 
-    // 4 add global/metadata/cache memory counter
+    // 4 add global/metadata/cache/Jvm memory counter
     _global_usage_counter =
             global_memory_overview_profile->AddHighWaterMarkCounter("Memory", 
TUnit::BYTES);
     _metadata_usage_counter =
             
metadata_memory_overview_profile->AddHighWaterMarkCounter("Memory", 
TUnit::BYTES);
     _cache_usage_counter =
             cache_memory_overview_profile->AddHighWaterMarkCounter("Memory", 
TUnit::BYTES);
+    _jvm_heap_memory_usage_counter =
+            jvm_memory_overview_profile->AddHighWaterMarkCounter("HeapMemory", 
TUnit::BYTES);
+    _jvm_non_heap_memory_usage_counter =
+            
jvm_memory_overview_profile->AddHighWaterMarkCounter("NonHeapMemory", 
TUnit::BYTES);
 
     // 5 add tasks memory counter
     _tasks_memory_usage_counter =
@@ -254,6 +261,15 @@ void MemoryProfile::refresh_memory_overview_profile() {
     COUNTER_SET(_jemalloc_memory_usage_counter,
                 _jemalloc_cache_usage_counter->current_value() +
                         _jemalloc_metadata_usage_counter->current_value());
+    DorisMetrics::instance()->jvm_metrics()->update();
+    int64_t jvm_heap_bytes =
+            
DorisMetrics::instance()->jvm_metrics()->jvm_heap_size_bytes_committed->value();
+    int64_t jvm_non_heap_bytes =
+            
DorisMetrics::instance()->jvm_metrics()->jvm_non_heap_size_bytes_committed->value();
+
+    all_tracked_mem_sum += jvm_heap_bytes + jvm_non_heap_bytes;
+    COUNTER_SET(_jvm_heap_memory_usage_counter, jvm_heap_bytes);
+    COUNTER_SET(_jvm_non_heap_memory_usage_counter, jvm_non_heap_bytes);
 
     COUNTER_SET(_tracked_memory_usage_counter, all_tracked_mem_sum);
     memory_all_tracked_sum_bytes << all_tracked_mem_sum - 
memory_all_tracked_sum_bytes.get_value();
diff --git a/be/src/runtime/memory/memory_profile.h 
b/be/src/runtime/memory/memory_profile.h
index 55b904bfb48..4a782468773 100644
--- a/be/src/runtime/memory/memory_profile.h
+++ b/be/src/runtime/memory/memory_profile.h
@@ -91,6 +91,10 @@ private:
     RuntimeProfile::HighWaterMarkCounter* _jemalloc_cache_usage_counter;
     RuntimeProfile::HighWaterMarkCounter* _jemalloc_metadata_usage_counter;
 
+    // JVM memory counter
+    RuntimeProfile::HighWaterMarkCounter* _jvm_heap_memory_usage_counter;
+    RuntimeProfile::HighWaterMarkCounter* _jvm_non_heap_memory_usage_counter;
+
     // global/metadata/cache memory counter
     RuntimeProfile::HighWaterMarkCounter* _global_usage_counter;
     RuntimeProfile::HighWaterMarkCounter* _metadata_usage_counter;


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

Reply via email to