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 "aicpusd_cust_dump_process.h"
11 :
12 : #include <string.h>
13 : #include <sched.h>
14 : #include <semaphore.h>
15 : #include "aicpusd_drv_manager.h"
16 : #include "aicpusd_util.h"
17 : #include "aicpusd_info.h"
18 : #include "aicpusd_proc_mgr_sys_operator_agent.h"
19 : #include "aicpusd_interface_process.h"
20 : #include "dump_task.h"
21 : #include "aicpusd_send_platform_Info_to_custom.h"
22 :
23 : namespace AicpuSchedule {
24 : namespace {
25 : // aicpusd 与 custaicpusd 是同样的groupid
26 : constexpr const uint32_t DATA_DUMP_GRUOP_ID = 31U;
27 : constexpr const uint32_t DATA_DUMP_THREAD_INDEX = 0U;
28 : constexpr const int32_t DATA_DUMP_TIMEOUT_INTERVAL = 3000;
29 : constexpr const uint32_t SLEEP_USECS = 50000U;
30 : constexpr const uint64_t DATA_DUMP_EVENT_MASK = (1ULL << static_cast<uint32_t>(EVENT_CCPU_CTRL_MSG));
31 : }; // namespace
32 3 : AicpuSdLoadPlatformInfoProcess& AicpuSdLoadPlatformInfoProcess::GetInstance()
33 : {
34 : static AicpuSdLoadPlatformInfoProcess instance;
35 3 : return instance;
36 : }
37 1 : int32_t AicpuSdLoadPlatformInfoProcess::SendLoadPlatformInfoMessageToCustSync(
38 : const uint8_t* const msg, const uint32_t len) const
39 : {
40 : UNUSED(msg);
41 : UNUSED(len);
42 1 : return AICPU_SCHEDULE_OK;
43 : }
44 1 : void AicpuSdLoadPlatformInfoProcess::LoadPlatformInfoSemPost()
45 : {
46 : UNUSED(loadPlatformInfoProcessSem_);
47 1 : return;
48 : }
49 1 : int32_t AicpuSdLoadPlatformInfoProcess::SendMsgToMain(const void* const msg, const uint32_t len)
50 : {
51 : UNUSED(msg);
52 : UNUSED(len);
53 1 : sem_init(&loadPlatformInfoProcessSem_, 0, 0U);
54 1 : sem_destroy(&loadPlatformInfoProcessSem_);
55 1 : return AICPU_SCHEDULE_OK;
56 : }
57 1 : AicpuSdCustDumpProcess::~AicpuSdCustDumpProcess() { UnitCustDataDumpProcess(); }
58 :
59 12 : AicpuSdCustDumpProcess& AicpuSdCustDumpProcess::GetInstance()
60 : {
61 12 : static AicpuSdCustDumpProcess instance;
62 12 : return instance;
63 : }
64 :
65 1 : AicpuSdCustDumpProcess::AicpuSdCustDumpProcess() : deviceId_(0U), runningFlag_(true), initFlag_(false) {}
66 :
67 1 : int32_t AicpuSdCustDumpProcess::InitCustDumpProcess(const uint32_t deviceId, const aicpu::AicpuRunMode runMode)
68 : {
69 1 : initFlag_ = false;
70 : UNUSED(deviceId);
71 : UNUSED(runMode);
72 1 : return 0;
73 : }
74 :
75 1 : int32_t AicpuSdCustDumpProcess::SetDataDumpThreadAffinity() const { return 0; }
76 :
77 1 : void AicpuSdCustDumpProcess::StartProcessEvent() {}
78 :
79 1 : void AicpuSdCustDumpProcess::LoopProcessEvent() {}
80 :
81 1 : int32_t AicpuSdCustDumpProcess::ProcessMessage(const int32_t timeout)
82 : {
83 : UNUSED(timeout);
84 1 : return 0;
85 : }
86 :
87 2 : void AicpuSdCustDumpProcess::UnitCustDataDumpProcess() {}
88 :
89 1 : int32_t AicpuSdCustDumpProcess::DoCustDatadumpTask(const event_info& drvEventInfo) const
90 : {
91 : UNUSED(drvEventInfo);
92 1 : return AICPU_SCHEDULE_OK;
93 : }
94 1 : int32_t AicpuSdCustDumpProcess::DoUdfDatadumpTask(const event_info& drvEventInfo) const
95 : {
96 : UNUSED(drvEventInfo);
97 1 : return AICPU_SCHEDULE_OK;
98 : }
99 1 : int32_t AicpuSdCustDumpProcess::DatadumpTaskProcess(const event_info& drvEventInfo) const
100 : {
101 : UNUSED(drvEventInfo);
102 1 : return AICPU_SCHEDULE_OK;
103 : }
104 1 : int32_t AicpuSdCustDumpProcess::DoUdfDatadumpSubmitEventSync(
105 : const char_t* const msg, const uint32_t len, struct event_proc_result& rsp) const
106 : {
107 : UNUSED(msg);
108 : UNUSED(len);
109 : UNUSED(rsp);
110 1 : return AICPU_SCHEDULE_OK;
111 : }
112 1 : bool AicpuSdCustDumpProcess::IsValidUdf(const int32_t sendPid) const
113 : {
114 : UNUSED(sendPid);
115 1 : return true;
116 : }
117 :
118 1 : bool AicpuSdCustDumpProcess::IsValidCustAicpu(const int32_t sendPid) const
119 : {
120 : UNUSED(sendPid);
121 1 : return true;
122 : }
123 : } // namespace AicpuSchedule
124 1 : int32_t CreateDatadumpThread(const struct TsdSubEventInfo* const msg)
125 : {
126 : UNUSED(msg);
127 1 : return AicpuSchedule::AICPU_SCHEDULE_OK;
128 : }
|