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_LEVEL_THREAD_HOLD_H
16 #define FAULT_LEVEL_THREAD_HOLD_H
17 
18 #include <string>
19 #include <climits>
20 
21 const int DEFAULT_LEVEL_A = UINT_MAX;
22 const int DEFAULT_LEVEL_B = UINT_MAX;
23 const int DEFAULT_LEVEL_C = UINT_MAX;
24 const std::string DEFAULT_COMMENT = "";
25 const int DEFAULT_DUMP_BITMAP = 0;
26 
27 struct FaultLevelThreshold {
28     unsigned int levelA{UINT_MAX}; /* A standard --total time span,0-invalid,unit:ms */
29     unsigned int levelB{UINT_MAX}; /* B standard --total time span,0-invalid,unit:ms */
30     unsigned int levelC{UINT_MAX}; /* C standard --total time span,0-invalid,unit:ms */
31     unsigned int dumpBitmap{DEFAULT_DUMP_BITMAP};
32     std::string comment{DEFAULT_COMMENT};
FaultLevelThresholdFaultLevelThreshold33     FaultLevelThreshold()
34     {
35         this->levelA = DEFAULT_LEVEL_A;
36         this->levelB = DEFAULT_LEVEL_B;
37         this->levelC = DEFAULT_LEVEL_C;
38         this->comment = DEFAULT_COMMENT;
39         this->dumpBitmap = DEFAULT_DUMP_BITMAP;
40     }
FaultLevelThresholdFaultLevelThreshold41     FaultLevelThreshold(const FaultLevelThreshold& faultLevelThreshold)
42     {
43         this->levelA = faultLevelThreshold.levelA;
44         this->levelB = faultLevelThreshold.levelB;
45         this->levelC = faultLevelThreshold.levelC;
46         this->comment = faultLevelThreshold.comment;
47         this->dumpBitmap = faultLevelThreshold.dumpBitmap;
48     }
49     FaultLevelThreshold& operator=(const FaultLevelThreshold& faultLevelThreshold)
50     {
51         this->levelA = faultLevelThreshold.levelA;
52         this->levelB = faultLevelThreshold.levelB;
53         this->levelC = faultLevelThreshold.levelC;
54         this->comment = faultLevelThreshold.comment;
55         this->dumpBitmap = faultLevelThreshold.dumpBitmap;
56         return *this;
57     }
58 };
59 #endif