Coverage Report

Created: 2026-03-15 01:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/runtime/workload_management/resource_context.cpp
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
#include "runtime/workload_management/resource_context.h"
19
20
#include <gen_cpp/data.pb.h>
21
#include <glog/logging.h>
22
23
#include "util/time.h"
24
25
namespace doris {
26
#include "common/compile_check_begin.h"
27
28
0
void ResourceContext::to_thrift_query_statistics(TQueryStatistics* statistics) const {
29
0
    DCHECK(statistics != nullptr);
30
0
    statistics->__set_scan_rows(io_context()->scan_rows());
31
0
    statistics->__set_scan_bytes(io_context()->scan_bytes());
32
0
    statistics->__set_cpu_ms(cpu_context()->cpu_cost_ms() / NANOS_PER_MILLIS);
33
0
    statistics->__set_returned_rows(io_context()->returned_rows());
34
0
    statistics->__set_max_peak_memory_bytes(memory_context()->max_peak_memory_bytes());
35
0
    statistics->__set_current_used_memory_bytes(memory_context()->current_memory_bytes());
36
0
    statistics->__set_shuffle_send_bytes(io_context()->shuffle_send_bytes());
37
0
    statistics->__set_shuffle_send_rows(io_context()->shuffle_send_rows());
38
0
    statistics->__set_scan_bytes_from_remote_storage(
39
0
            io_context()->scan_bytes_from_remote_storage());
40
0
    statistics->__set_scan_bytes_from_local_storage(io_context()->scan_bytes_from_local_storage());
41
0
    statistics->__set_bytes_write_into_cache(io_context()->bytes_write_into_cache());
42
43
0
    if (workload_group() != nullptr) {
44
0
        statistics->__set_workload_group_id(workload_group()->id());
45
0
    } else {
46
0
        statistics->__set_workload_group_id(-1);
47
0
    }
48
49
0
    statistics->__set_spill_write_bytes_to_local_storage(
50
0
            io_context_->spill_write_bytes_to_local_storage());
51
0
    statistics->__set_spill_read_bytes_from_local_storage(
52
0
            io_context_->spill_read_bytes_from_local_storage());
53
0
}
54
55
#include "common/compile_check_end.h"
56
} // namespace doris