[profile](sort) add some metrics in profile (#21056)
This commit is contained in:
@ -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) {
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user