Coverage Report

Created: 2026-08-18 10:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
common/cpp/obj-client/client_bvar.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
20
#include <bvar/latency_recorder.h>
21
22
#include <chrono>
23
24
namespace doris {
25
26
namespace client_bvar {
27
28
class ScopedLatency {
29
public:
30
    explicit ScopedLatency(bvar::LatencyRecorder& recorder)
31
417k
            : recorder_(recorder), start_(std::chrono::steady_clock::now()) {}
32
417k
    ~ScopedLatency() {
33
417k
        recorder_ << std::chrono::duration_cast<std::chrono::microseconds>(
34
417k
                             std::chrono::steady_clock::now() - start_)
35
417k
                             .count();
36
417k
    }
37
38
    ScopedLatency(const ScopedLatency&) = delete;
39
    ScopedLatency& operator=(const ScopedLatency&) = delete;
40
41
private:
42
    bvar::LatencyRecorder& recorder_;
43
    std::chrono::steady_clock::time_point start_;
44
};
45
46
extern bvar::LatencyRecorder s3_get_latency;
47
extern bvar::LatencyRecorder s3_put_latency;
48
extern bvar::LatencyRecorder s3_delete_object_latency;
49
extern bvar::LatencyRecorder s3_delete_objects_latency;
50
extern bvar::LatencyRecorder s3_head_latency;
51
extern bvar::LatencyRecorder s3_multi_part_upload_latency;
52
extern bvar::LatencyRecorder s3_list_latency;
53
extern bvar::LatencyRecorder s3_list_object_versions_latency;
54
extern bvar::LatencyRecorder s3_get_bucket_version_latency;
55
extern bvar::LatencyRecorder s3_copy_object_latency;
56
} // namespace client_bvar
57
58
} // namespace doris