• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include <string.h>
16 #include "comm_log.h"
17 #include "softbus_def.h"
18 #include "softbus_error_code.h"
19 #include "legacy/softbus_hidumper_alarm.h"
20 #include "legacy/softbus_hidumper_stats.h"
21 #include "legacy/softbus_hidumper_util.h"
22 #include "legacy/softbus_hidumper.h"
23 
SoftBusDumpProcess(int fd,int32_t argc,const char ** argv)24 int32_t SoftBusDumpProcess(int fd, int32_t argc, const char **argv)
25 {
26     if (fd < 0 || argc < 0 || argv == NULL) {
27         COMM_LOGE(COMM_DFX, "SoftBusDumpProcess: param invalid ");
28         return SOFTBUS_INVALID_PARAM;
29     }
30     return SoftBusDumpDispatch(fd, argc, argv);
31 }
32 
SoftBusHiDumperInit(void)33 int32_t SoftBusHiDumperInit(void)
34 {
35     if (SoftBusAlarmHiDumperInit() != SOFTBUS_OK) {
36         COMM_LOGE(COMM_INIT, "init Alarm HiDumper fail!");
37         return SOFTBUS_DFX_INIT_FAILED;
38     }
39 
40     if (SoftBusHidumperUtilInit() != SOFTBUS_OK || SoftBusHiDumperModuleInit() != SOFTBUS_OK) {
41         COMM_LOGE(COMM_INIT, "SoftBusHiDumperInit fail!");
42         return SOFTBUS_DFX_INIT_FAILED;
43     }
44 
45     if (SoftBusStatsHiDumperInit() != SOFTBUS_OK) {
46         COMM_LOGE(COMM_INIT, "init Stats HiDumper fail!");
47         return SOFTBUS_DFX_INIT_FAILED;
48     }
49     return SOFTBUS_OK;
50 }
51 
SoftBusHiDumperDeinit(void)52 void SoftBusHiDumperDeinit(void)
53 {
54     SoftBusHiDumperModuleDeInit();
55 }