Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 : #include "adx_datadump_server_soc.h"
11 : #include "adx_datadump_server.h"
12 : #include "component/adx_server_manager.h"
13 : #include "epoll/adx_sock_epoll.h"
14 : #include "commopts/sock_comm_opt.h"
15 : #include "log/adx_log.h"
16 : #include "adx_dump_record.h"
17 : namespace Adx {
18 2 : int32_t AdxSocDataDumpInit(const std::string &hostPid)
19 : {
20 : // soc case, pass host pid to record instance
21 2 : int ret = AdxDumpRecord::Instance().Init(hostPid);
22 2 : if (ret != IDE_DAEMON_OK) {
23 1 : IDE_LOGE("AdxDumpRecord init failed.");
24 1 : return IDE_DAEMON_ERROR;
25 : }
26 1 : ret = AdxDumpRecord::Instance().StartRecord();
27 1 : if (ret != IDE_DAEMON_OK) {
28 0 : IDE_LOGE("start dump record thread failed.");
29 0 : return IDE_DAEMON_ERROR;
30 : }
31 1 : IDE_LOGI("Adx soc dump thread has been started.");
32 1 : return IDE_DAEMON_OK;
33 : }
34 :
35 1 : int32_t AdxSocDataDumpUnInit()
36 : {
37 1 : IDE_LOGI("start to do soc dump uninit");
38 1 : return AdxDumpRecord::Instance().UnInit();
39 : }
40 : }
41 :
42 : #if !defined(__IDE_UT) && !defined(__IDE_ST)
43 : /**
44 : * @brief stub for init in soc case, real init
45 : * in constructor function
46 : *
47 : * @return
48 : * IDE_DAEMON_OK: datadump server init success
49 : */
50 : int32_t AdxDataDumpServerInit()
51 : {
52 : return IDE_DAEMON_OK;
53 : }
54 :
55 : /**
56 : * @brief stub for uninit in soc case, real uninit
57 : * in destructor function
58 : *
59 : * @return
60 : * IDE_DAEMON_OK: datadump server uninit success
61 : */
62 : int32_t AdxDataDumpServerUnInit()
63 : {
64 : return IDE_DAEMON_OK;
65 : }
66 : #endif
|