Coverage Report

Created: 2026-10-23 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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
    RuntimeProfile::Counter* spill_remote_upload_bytes = nullptr;
37
    RuntimeProfile::Counter* spill_remote_upload_timer = nullptr;
38
    RuntimeProfile::Counter* spill_remote_upload_wait_timer = nullptr;
39
40
2.47k
    void init(RuntimeProfile* profile) {
41
2.47k
        spill_write_timer = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_TIME, 1);
42
2.47k
        spill_write_wait_in_queue_task_count = ADD_COUNTER_WITH_LEVEL(
43
2.47k
                profile, profile::SPILL_WRITE_TASK_WAIT_IN_QUEUE_COUNT, TUnit::UNIT, 1);
44
2.47k
        spill_writing_task_count =
45
2.47k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_TASK_COUNT, TUnit::UNIT, 1);
46
2.47k
        spill_write_wait_in_queue_timer =
47
2.47k
                ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_TASK_WAIT_IN_QUEUE_TIME, 1);
48
2.47k
        spill_write_file_timer = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_FILE_TIME, 1);
49
2.47k
        spill_write_serialize_block_timer =
50
2.47k
                ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_WRITE_SERIALIZE_BLOCK_TIME, 1);
51
2.47k
        spill_write_block_count =
52
2.47k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_BLOCK_COUNT, TUnit::UNIT, 1);
53
2.47k
        spill_write_block_data_size =
54
2.47k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_BLOCK_BYTES, TUnit::BYTES, 1);
55
2.47k
        spill_write_rows_count =
56
2.47k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_WRITE_ROWS, TUnit::UNIT, 1);
57
2.47k
        spill_remote_upload_bytes = ADD_COUNTER_WITH_LEVEL(
58
2.47k
                profile, profile::SPILL_REMOTE_UPLOAD_BYTES, TUnit::BYTES, 1);
59
2.47k
        spill_remote_upload_timer =
60
2.47k
                ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_REMOTE_UPLOAD_TIME, 1);
61
2.47k
        spill_remote_upload_wait_timer =
62
2.47k
                ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_REMOTE_UPLOAD_WAIT_TIME, 1);
63
2.47k
    }
64
};
65
66
// Shared spill read counters, used only by PipelineXSpillLocalState (source).
67
struct SpillReadCounters {
68
    RuntimeProfile::Counter* spill_recover_time = nullptr;
69
    RuntimeProfile::Counter* spill_read_wait_in_queue_task_count = nullptr;
70
    RuntimeProfile::Counter* spill_reading_task_count = nullptr;
71
    RuntimeProfile::Counter* spill_read_wait_in_queue_timer = nullptr;
72
    RuntimeProfile::Counter* spill_read_file_time = nullptr;
73
    RuntimeProfile::Counter* spill_read_deserialize_block_timer = nullptr;
74
    RuntimeProfile::Counter* spill_read_block_count = nullptr;
75
    RuntimeProfile::Counter* spill_read_block_data_size = nullptr;
76
    RuntimeProfile::Counter* spill_read_file_size = nullptr;
77
    RuntimeProfile::Counter* spill_read_rows_count = nullptr;
78
    RuntimeProfile::Counter* spill_read_file_count = nullptr;
79
    RuntimeProfile::Counter* spill_remote_read_requests = nullptr;
80
81
5.60k
    void init(RuntimeProfile* profile) {
82
5.60k
        spill_recover_time = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_RECOVER_TIME, 1);
83
5.60k
        spill_read_wait_in_queue_task_count = ADD_COUNTER_WITH_LEVEL(
84
5.60k
                profile, profile::SPILL_READ_TASK_WAIT_IN_QUEUE_COUNT, TUnit::UNIT, 1);
85
5.60k
        spill_reading_task_count =
86
5.60k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_TASK_COUNT, TUnit::UNIT, 1);
87
5.60k
        spill_read_wait_in_queue_timer =
88
5.60k
                ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_READ_TASK_WAIT_IN_QUEUE_TIME, 1);
89
5.60k
        spill_read_file_time = ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_READ_FILE_TIME, 1);
90
5.60k
        spill_read_deserialize_block_timer =
91
5.60k
                ADD_TIMER_WITH_LEVEL(profile, profile::SPILL_READ_DESERIALIZE_BLOCK_TIME, 1);
92
5.60k
        spill_read_block_count =
93
5.60k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_BLOCK_COUNT, TUnit::UNIT, 1);
94
5.60k
        spill_read_block_data_size =
95
5.60k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_BLOCK_BYTES, TUnit::BYTES, 1);
96
5.60k
        spill_read_file_size =
97
5.60k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_FILE_BYTES, TUnit::BYTES, 1);
98
5.60k
        spill_read_rows_count =
99
5.60k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_ROWS, TUnit::UNIT, 1);
100
5.60k
        spill_read_file_count =
101
5.60k
                ADD_COUNTER_WITH_LEVEL(profile, profile::SPILL_READ_FILE_COUNT, TUnit::UNIT, 1);
102
5.60k
        spill_remote_read_requests = ADD_COUNTER_WITH_LEVEL(
103
5.60k
                profile, profile::SPILL_REMOTE_READ_REQUESTS, TUnit::UNIT, 1);
104
5.60k
    }
105
};
106
107
} // namespace doris