1 /*
2  * Copyright (c) 2024 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 FAULT_COMMON_BASE_H
16 #define FAULT_COMMON_BASE_H
17 
18 #include <string>
19 #include <vector>
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 #define MAX_MONITOR_PROCESS_CNT 10
24 typedef enum FaultLevel {
25     Normal = 0,
26     Minor,
27     Serious,
28     Critical,
29     CriticalDfx,
30     AllFaultLevel
31 } FaultLevel;
32 
33 typedef enum ErrCode {
34     SUCCESSED = 0,
35     FAILURE
36 } ErrorCode;
37 
38 enum DetectorType {
39     NATIVE_LEAK_DETECTOR,
40     DETECTOR_SIZE
41 };
42 
43 const std::vector<std::string> DetectorTypeName = {
44     "native_leak_detector"
45 };
46 
47 enum FaultStateType {
48     PROC_IDLE_STATE = 0,
49     PROC_SAMPLE_STATE,
50     PROC_JUDGE_STATE,
51     PROC_DUMP_STATE,
52     PROC_REPORT_STATE,
53     PROC_REMOVAL_STATE,
54     PROC_FINISHED_STATE
55 };
56 
57 const std::string FaultStateName[] = {
58     "[ProcIdleState]",
59     "[ProcSampleState]",
60     "[ProcJudgeState]",
61     "[ProcDumpState]",
62     "[ProcReportState]",
63     "[ProcRemovalState]",
64     "[ProcFinishedState]"
65 };
66 
67 } // namespace HiviewDFX
68 } // namespace OHOS
69 #endif // FAULT_COMMON_BASE_H
70