be/src/exec/operator/spill_counters.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | #include "runtime/runtime_profile.h" |
20 | | #include "runtime/runtime_profile_counter_names.h" |
21 | | |
22 | | namespace doris { |
23 | | |
24 | | // Shared spill write counters, used by both PipelineXSpillLocalState (source) |
25 | | // and PipelineXSpillSinkLocalState (sink) to eliminate duplicated counter definitions. |
26 | | struct SpillWriteCounters { |
27 | | RuntimeProfile::Counter* spill_write_timer = nullptr; |
28 | | RuntimeProfile::Counter* spill_write_wait_in_queue_task_count = nullptr; |
29 | | RuntimeProfile::Counter* spill_writing_task_count = nullptr; |
30 | | RuntimeProfile::Counter* spill_write_wait_in_queue_timer = nullptr; |
31 | | RuntimeProfile::Counter* spill_write_file_timer = nullptr; |
32 | | RuntimeProfile::Counter* spill_write_serialize_block_timer = nullptr; |
33 | | RuntimeProfile::Counter* spill_write_block_count = nullptr; |
34 | | RuntimeProfile::Counter* spill_write_block_data_size = nullptr; |
35 | | RuntimeProfile::Counter* spill_write_rows_count = nullptr; |
36 | | |
37 | 5.53k | void init(RuntimeProfile* profile) { |
38 | 5.53k | spill_write_timer = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_TIME, 1); |
39 | 5.53k | spill_write_wait_in_queue_task_count = ADD_COUNTER_WITH_LEVEL( |
40 | 5.53k | profile, profile::SPILL_WRITE_TASK_WAIT_IN_QUEUE_COUNT, TUnit::UNIT, 1); |
41 | 5.53k | spill_writing_task_count = |
42 | 5.53k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_TASK_COUNT, TUnit::UNIT, 1); |
43 | 5.53k | spill_write_wait_in_queue_timer = |
44 | 5.53k | ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_TASK_WAIT_IN_QUEUE_TIME, 1); |
45 | 5.53k | spill_write_file_timer = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_FILE_TIME, 1); |
46 | 5.53k | spill_write_serialize_block_timer = |
47 | 5.53k | ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_SERIALIZE_BLOCK_TIME, 1); |
48 | 5.53k | spill_write_block_count = |
49 | 5.53k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_BLOCK_COUNT, TUnit::UNIT, 1); |
50 | 5.53k | spill_write_block_data_size = |
51 | 5.53k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_BLOCK_BYTES, TUnit::BYTES, 1); |
52 | 5.53k | spill_write_rows_count = |
53 | 5.53k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_ROWS, TUnit::UNIT, 1); |
54 | 5.53k | } |
55 | | }; |
56 | | |
57 | | // Shared spill read counters, used only by PipelineXSpillLocalState (source). |
58 | | struct SpillReadCounters { |
59 | | RuntimeProfile::Counter* spill_recover_time = nullptr; |
60 | | RuntimeProfile::Counter* spill_read_wait_in_queue_task_count = nullptr; |
61 | | RuntimeProfile::Counter* spill_reading_task_count = nullptr; |
62 | | RuntimeProfile::Counter* spill_read_wait_in_queue_timer = nullptr; |
63 | | RuntimeProfile::Counter* spill_read_file_time = nullptr; |
64 | | RuntimeProfile::Counter* spill_read_deserialize_block_timer = nullptr; |
65 | | RuntimeProfile::Counter* spill_read_block_count = nullptr; |
66 | | RuntimeProfile::Counter* spill_read_block_data_size = nullptr; |
67 | | RuntimeProfile::Counter* spill_read_file_size = nullptr; |
68 | | RuntimeProfile::Counter* spill_read_rows_count = nullptr; |
69 | | RuntimeProfile::Counter* spill_read_file_count = nullptr; |
70 | | |
71 | 12.2k | void init(RuntimeProfile* profile) { |
72 | 12.2k | spill_recover_time = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_RECOVER_TIME, 1); |
73 | 12.2k | spill_read_wait_in_queue_task_count = ADD_COUNTER_WITH_LEVEL( |
74 | 12.2k | profile, profile::SPILL_READ_TASK_WAIT_IN_QUEUE_COUNT, TUnit::UNIT, 1); |
75 | 12.2k | spill_reading_task_count = |
76 | 12.2k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_TASK_COUNT, TUnit::UNIT, 1); |
77 | 12.2k | spill_read_wait_in_queue_timer = |
78 | 12.2k | ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_READ_TASK_WAIT_IN_QUEUE_TIME, 1); |
79 | 12.2k | spill_read_file_time = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_READ_FILE_TIME, 1); |
80 | 12.2k | spill_read_deserialize_block_timer = |
81 | 12.2k | ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_READ_DESERIALIZE_BLOCK_TIME, 1); |
82 | 12.2k | spill_read_block_count = |
83 | 12.2k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_BLOCK_COUNT, TUnit::UNIT, 1); |
84 | 12.2k | spill_read_block_data_size = |
85 | 12.2k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_BLOCK_BYTES, TUnit::BYTES, 1); |
86 | 12.2k | spill_read_file_size = |
87 | 12.2k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_FILE_BYTES, TUnit::BYTES, 1); |
88 | 12.2k | spill_read_rows_count = |
89 | 12.2k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_ROWS, TUnit::UNIT, 1); |
90 | 12.2k | spill_read_file_count = |
91 | 12.2k | ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_FILE_COUNT, TUnit::UNIT, 1); |
92 | 12.2k | } |
93 | | }; |
94 | | |
95 | | } // namespace doris |