1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef DFX_CONFIG_H
16 #define DFX_CONFIG_H
17 
18 #include <string>
19 
20 namespace OHOS {
21 namespace HiviewDFX {
22 struct DfxConfigInfo {
23     bool displayBacktrace = true;
24     bool displayRegister = true;
25     bool displayMaps = true;
26     bool displayFaultStack = true;
27     bool logPersist = false;
28     bool dumpOtherThreads = false;
29     unsigned int lowAddressStep = 16;
30     unsigned int highAddressStep = 64;
31     unsigned int maxFrameNums = 64;
32     unsigned int writeSleepTime = 0;
33 };
34 
35 class DfxConfig {
36 public:
37     static DfxConfigInfo& GetConfig();
38 
39 private:
40     static void ReadConfig(DfxConfigInfo& config);
41     static void ParserConfig(DfxConfigInfo& config, const std::string& key, const std::string& value);
42 private:
43     DfxConfig() = default;
44     ~DfxConfig() = default;
45 };
46 } // namespace HiviewDFX
47 } // namespace OHOS
48 
49 #endif
50