xinyiZzz commented on code in PR #41310:
URL: https://github.com/apache/doris/pull/41310#discussion_r1795457905


##########
be/src/runtime/memory/memory_profile.h:
##########
@@ -0,0 +1,75 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include "util/runtime_profile.h"
+
+namespace doris {
+
+class MemoryProfile {
+public:
+    static std::string print_process_memory_overview_profile() {
+        std::lock_guard<std::mutex> 
l(MemoryProfile::_process_memory_overview_profile_lock);
+        std::stringstream ss;
+        _process_memory_overview_profile->pretty_print(&ss);
+        return ss.str();
+    }
+    static std::string print_tasks_memory_profile() {
+        std::lock_guard<std::mutex> 
l(MemoryProfile::_tasks_memory_profile_lock);
+        std::stringstream ss;
+        _tasks_memory_profile->pretty_print(&ss);
+        return ss.str();
+    }
+    static std::string print_top_memory_tasks_profile() {
+        std::lock_guard<std::mutex> 
l(MemoryProfile::_process_memory_overview_profile_lock);
+        std::stringstream ss;
+        _top_memory_tasks_profile->pretty_print(&ss);
+        return ss.str();
+    }
+    static std::string print_global_memory_profile() {
+        std::lock_guard<std::mutex> 
l(MemoryProfile::_process_memory_overview_profile_lock);
+        std::stringstream ss;
+        _global_memory_profile->pretty_print(&ss);
+        return ss.str();
+    }
+
+    static void refresh_memory_overview_profile();
+    static void refresh_tasks_memory_profile();
+
+    static int64_t query_current_usage();
+    static int64_t load_current_usage();
+    static int64_t compaction_current_usage();
+    static int64_t schema_change_current_usage();
+    static int64_t other_current_usage();
+
+    // process memory changes more than 256M, or the GC ends
+    static void enable_print_log_process_usage() { 
_enable_print_log_process_usage = true; }
+    static void print_log_process_usage();
+
+    static std::unique_ptr<RuntimeProfile> _process_memory_overview_profile;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to