You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/06/21 14:57:53 UTC

[doris] branch master updated: [profile](sort) add some metrics in profile (#21056)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2ce8cfbebd [profile](sort) add some metrics in profile (#21056)
2ce8cfbebd is described below

commit 2ce8cfbebd655c8115b8adf9e247f8a152d5a1d1
Author: Gabriel <ga...@gmail.com>
AuthorDate: Wed Jun 21 22:57:46 2023 +0800

    [profile](sort) add some metrics in profile (#21056)
---
 be/src/vec/exec/vsort_node.cpp | 25 ++++++++++++++++++-------
 be/src/vec/exec/vsort_node.h   |  4 ++++
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/be/src/vec/exec/vsort_node.cpp b/be/src/vec/exec/vsort_node.cpp
index a4501e82f3..45ef327dd3 100644
--- a/be/src/vec/exec/vsort_node.cpp
+++ b/be/src/vec/exec/vsort_node.cpp
@@ -120,6 +120,9 @@ Status VSortNode::prepare(RuntimeState* state) {
             ADD_CHILD_COUNTER(runtime_profile(), "SortBlocks", TUnit::BYTES, "MemoryUsage");
 
     RETURN_IF_ERROR(_vsort_exec_exprs.prepare(state, child(0)->row_desc(), _row_descriptor));
+    _child_get_next_timer = ADD_TIMER(runtime_profile(), "ChildGetResultTime");
+    _get_next_timer = ADD_TIMER(runtime_profile(), "GetResultTime");
+    _sink_timer = ADD_TIMER(runtime_profile(), "PartialSortTotalTime");
     return Status::OK();
 }
 
@@ -173,13 +176,20 @@ Status VSortNode::open(RuntimeState* state) {
     bool eos = false;
     std::unique_ptr<Block> upstream_block = Block::create_unique();
     do {
-        RETURN_IF_ERROR(child(0)->get_next_after_projects(
-                state, upstream_block.get(), &eos,
-                std::bind((Status(ExecNode::*)(RuntimeState*, vectorized::Block*, bool*)) &
-                                  ExecNode::get_next,
-                          _children[0], std::placeholders::_1, std::placeholders::_2,
-                          std::placeholders::_3)));
-        RETURN_IF_ERROR_OR_CATCH_EXCEPTION(sink(state, upstream_block.get(), eos));
+        {
+            SCOPED_TIMER(_child_get_next_timer);
+            RETURN_IF_ERROR(child(0)->get_next_after_projects(
+                    state, upstream_block.get(), &eos,
+                    std::bind((Status(ExecNode::*)(RuntimeState*, vectorized::Block*, bool*)) &
+                                      ExecNode::get_next,
+                              _children[0], std::placeholders::_1, std::placeholders::_2,
+                              std::placeholders::_3)));
+        }
+        {
+            SCOPED_TIMER(_sink_timer);
+            RETURN_IF_ERROR_OR_CATCH_EXCEPTION(sink(state, upstream_block.get(), eos));
+        }
+
     } while (!eos);
 
     child(0)->close(state);
@@ -191,6 +201,7 @@ Status VSortNode::open(RuntimeState* state) {
 }
 
 Status VSortNode::pull(doris::RuntimeState* state, vectorized::Block* output_block, bool* eos) {
+    SCOPED_TIMER(_get_next_timer);
     RETURN_IF_ERROR_OR_CATCH_EXCEPTION(_sorter->get_next(state, output_block, eos));
     reached_limit(output_block, eos);
     if (*eos) {
diff --git a/be/src/vec/exec/vsort_node.h b/be/src/vec/exec/vsort_node.h
index 7798493102..37c781bde2 100644
--- a/be/src/vec/exec/vsort_node.h
+++ b/be/src/vec/exec/vsort_node.h
@@ -97,6 +97,10 @@ private:
 
     std::unique_ptr<Sorter> _sorter;
 
+    RuntimeProfile::Counter* _child_get_next_timer = nullptr;
+    RuntimeProfile::Counter* _sink_timer = nullptr;
+    RuntimeProfile::Counter* _get_next_timer = nullptr;
+
     static constexpr size_t ACCUMULATED_PARTIAL_SORT_THRESHOLD = 256;
 };
 


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