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

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


The following commit(s) were added to refs/heads/spill_and_reserve by this push:
     new 82761ed664e add reserve time and failed counter
82761ed664e is described below

commit 82761ed664ee474462016af759893e1cc1ac41d2
Author: yiguolei <yiguo...@gmail.com>
AuthorDate: Sat Sep 28 18:31:26 2024 +0800

    add reserve time and failed counter
---
 be/src/pipeline/pipeline_task.cpp | 6 ++++++
 be/src/pipeline/pipeline_task.h   | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/be/src/pipeline/pipeline_task.cpp 
b/be/src/pipeline/pipeline_task.cpp
index aa2b01b741a..37b44c6e6f1 100644
--- a/be/src/pipeline/pipeline_task.cpp
+++ b/be/src/pipeline/pipeline_task.cpp
@@ -195,6 +195,9 @@ void PipelineTask::_init_profile() {
     _schedule_counts = ADD_COUNTER(_task_profile, "NumScheduleTimes", 
TUnit::UNIT);
     _yield_counts = ADD_COUNTER(_task_profile, "NumYieldTimes", TUnit::UNIT);
     _core_change_times = ADD_COUNTER(_task_profile, "CoreChangeTimes", 
TUnit::UNIT);
+    _memory_reserve_times = ADD_COUNTER(_task_profile, "MemoryReserveTimes", 
TUnit::UNIT);
+    _memory_reserve_failed_times =
+            ADD_COUNTER(_task_profile, "MemoryReserveFailedTimes", 
TUnit::UNIT);
 }
 
 void PipelineTask::_fresh_profile_counter() {
@@ -385,7 +388,10 @@ Status PipelineTask::execute(bool* eos) {
             auto workload_group = _state->get_query_ctx()->workload_group();
             if (workload_group && reserve_size > 0) {
                 auto st = thread_context()->try_reserve_memory(reserve_size);
+
+                COUNTER_UPDATE(_memory_reserve_times, 1);
                 if (!st.ok()) {
+                    COUNTER_UPDATE(_memory_reserve_failed_times, 1);
                     LOG(INFO) << "query: " << print_id(query_id)
                               << ", try to reserve: " << reserve_size << 
"(sink reserve size:("
                               << sink_reserve_size << ")"
diff --git a/be/src/pipeline/pipeline_task.h b/be/src/pipeline/pipeline_task.h
index 633cca93f46..5d1c571ea26 100644
--- a/be/src/pipeline/pipeline_task.h
+++ b/be/src/pipeline/pipeline_task.h
@@ -302,6 +302,8 @@ private:
     // TODO we should calculate the time between when really runnable and 
runnable
     RuntimeProfile::Counter* _yield_counts = nullptr;
     RuntimeProfile::Counter* _core_change_times = nullptr;
+    RuntimeProfile::Counter* _memory_reserve_times = nullptr;
+    RuntimeProfile::Counter* _memory_reserve_failed_times = nullptr;
 
     MonotonicStopWatch _pipeline_task_watcher;
 


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

Reply via email to