[profile](remove child) child is for node, should not be used to organize counters (#20676)

Currently, there are many profiles using add child profile to orgnanize profile into blocks. But it is wrong. Child profile will have a total time counter. Actually, what we should use is just a label.

                          -  MemoryUsage:  
                              -  HashTable:  23.98  KB
                              -  SerializeKeyArena:  446.75  KB
Add a new macro ADD_LABEL_COUNTER to add just a label in the profile.

---------

Co-authored-by: yiguolei <yiguolei@gmail.com>
This commit is contained in:
yiguolei
2023-06-12 10:00:35 +08:00
committed by GitHub
parent ab7ac31d89
commit a6f625676b
17 changed files with 44 additions and 97 deletions

View File

@ -323,11 +323,11 @@ void AggregationNode::_init_hash_method(const VExprContextSPtrs& probe_exprs) {
}
Status AggregationNode::prepare_profile(RuntimeState* state) {
auto* memory_usage = runtime_profile()->create_child("PeakMemoryUsage", true, true);
runtime_profile()->add_child(memory_usage, false, nullptr);
_hash_table_memory_usage = ADD_COUNTER(memory_usage, "HashTable", TUnit::BYTES);
_serialize_key_arena_memory_usage =
memory_usage->AddHighWaterMarkCounter("SerializeKeyArena", TUnit::BYTES);
_memory_usage_counter = ADD_LABEL_COUNTER(runtime_profile(), "MemoryUsage");
_hash_table_memory_usage =
ADD_CHILD_COUNTER(runtime_profile(), "HashTable", TUnit::BYTES, "MemoryUsage");
_serialize_key_arena_memory_usage = runtime_profile()->AddHighWaterMarkCounter(
"SerializeKeyArena", TUnit::BYTES, "MemoryUsage");
_build_timer = ADD_TIMER(runtime_profile(), "BuildTime");
_build_table_convert_timer = ADD_TIMER(runtime_profile(), "BuildConvertToPartitionedTime");