• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 __FFRT_BBOX_H__
16 #define __FFRT_BBOX_H__
17 #ifdef FFRT_BBOX_ENABLE
18 
19 #include <string>
20 
21 extern void TaskWakeCounterInc(void);
22 extern void TaskPendingCounterInc(void);
23 extern unsigned int GetBboxEnableState(void);
24 extern unsigned int GetBboxCalledTimes(void);
25 
26 typedef void (*FuncGetKeyStatus)();
27 typedef void (*FuncSaveKeyStatus)();
28 typedef std::string (*FuncSaveKeyStatusInfo)();
29 std::string SaveKeyInfo(void);
30 void SetFuncSaveKeyStatus(FuncGetKeyStatus getFunc, FuncSaveKeyStatus saveFunc, FuncSaveKeyStatusInfo infoFunc);
31 
32 // undefine in header for non-inline to explain why stop
33 void BboxFreeze(void);
34 
35 // define in header for inline to speedup
BboxCheckAndFreeze(void)36 static inline void BboxCheckAndFreeze(void)
37 {
38     if (GetBboxEnableState() != 0) {
39         BboxFreeze();
40     }
41 }
42 
43 bool FFRTIsWork(void);
44 void RecordDebugInfo(void);
45 
46 std::string GetDumpPreface(void);
47 #ifdef FFRT_CO_BACKTRACE_OH_ENABLE
48 #if (FFRT_TRACE_RECORD_LEVEL >= FFRT_TRACE_RECORD_LEVEL_2)
49 std::string SaveTaskCounterInfo(void);
50 #endif
51 std::string SaveWorkerStatusInfo(void);
52 std::string SaveNormalTaskStatusInfo(void);
53 std::string SaveQueueTaskStatusInfo(void);
54 std::string SaveTimeoutTaskInfo(void);
55 std::string SaveQueueTrafficRecordInfo(void);
56 #endif
57 #else
BboxCheckAndFreeze(void)58 static inline void BboxCheckAndFreeze(void)
59 {}
60 #endif /* FFRT_BBOX_ENABLE */
61 void backtrace(int ignoreDepth);
62 #endif /* __FFRT_BBOX_H__ */
63