Coverage Report

Created: 2026-03-11 11:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/be/src/runtime/process_profile.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 "common/multi_version.h"
21
#include "runtime/exec_env.h"
22
#include "runtime/memory/memory_profile.h"
23
#include "runtime/runtime_profile.h"
24
25
namespace doris {
26
27
class ProcessProfile {
28
public:
29
1
    static ProcessProfile* create_global_instance() { return new ProcessProfile(); }
30
2
    static ProcessProfile* instance() { return ExecEnv::GetInstance()->get_process_profile(); }
31
    ProcessProfile();
32
33
    void refresh_profile();
34
35
0
    std::string print_process_profile() const {
36
0
        auto version_ptr = _process_profile.get();
37
0
        std::stringstream ss;
38
0
        version_ptr->pretty_print(&ss);
39
0
        return ss.str();
40
0
    }
41
42
0
    std::string print_process_profile_no_root() const {
43
0
        std::stringstream ss;
44
0
        std::vector<RuntimeProfile*> profiles;
45
0
        auto version_ptr = _process_profile.get();
46
0
        auto* process_profile = version_ptr.get();
47
0
        process_profile->get_children(&profiles);
48
0
        for (auto* profile : profiles) {
49
0
            profile->pretty_print(&ss);
50
0
        }
51
0
        return ss.str();
52
0
    }
53
54
2
    MemoryProfile* memory_profile() { return _memory_profile.get(); }
55
56
private:
57
    MultiVersion<RuntimeProfile> _process_profile;
58
    std::unique_ptr<MemoryProfile> _memory_profile;
59
};
60
61
} // namespace doris