Coverage Report

Created: 2026-08-20 04:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/io/fs/tracing_file_reader.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 "common/status.h"
20
#include "io/fs/file_reader.h"
21
#include "io/io_common.h"
22
#include "runtime/runtime_profile.h"
23
24
namespace doris {
25
26
namespace io {
27
28
class TracingFileReader : public FileReader {
29
public:
30
    TracingFileReader(doris::io::FileReaderSPtr inner, FileReaderStats* stats)
31
246
            : _inner(std::move(inner)), _stats(stats) {}
32
33
    Status read_at_impl(size_t offset, Slice result, size_t* bytes_read,
34
956
                        const IOContext* io_ctx) override {
35
956
        SCOPED_RAW_TIMER(&_stats->read_time_ns);
36
956
        Status st = _inner->read_at(offset, result, bytes_read, io_ctx);
37
956
        _stats->read_calls++;
38
956
        _stats->read_bytes += *bytes_read;
39
956
        return st;
40
956
    }
41
42
0
    Status close() override { return _inner->close(); }
43
371
    const doris::io::Path& path() const override { return _inner->path(); }
44
767
    size_t size() const override { return _inner->size(); }
45
0
    bool closed() const override { return _inner->closed(); }
46
0
    const std::string& get_data_dir_path() override { return _inner->get_data_dir_path(); }
47
48
0
    void _collect_profile_at_runtime() override { return _inner->collect_profile_at_runtime(); }
49
142
    void _collect_profile_before_close() override { return _inner->collect_profile_before_close(); }
50
51
265
    int64_t mtime() const override { return _inner->mtime(); }
52
53
0
    FileReaderStats* stats() const { return _stats; }
54
62
    doris::io::FileReaderSPtr inner_reader() { return _inner; }
55
56
private:
57
    doris::io::FileReaderSPtr _inner;
58
    FileReaderStats* _stats;
59
};
60
61
} // namespace io
62
} // namespace doris