已合并
【PR】: 【fix】close dump session #2670
liu-lu创建于 6月8日
【PR】: 【fix】close dump session #2670
已合并
共 8 个文件变更+60-12
| @@ -555,6 +555,7 @@ namespace AicpuSchedule { | |||
| 555 | (void)Destroy(); | 555 | (void)Destroy(); |
| 556 | noThreadFlag_ = true; | 556 | noThreadFlag_ = true; |
| 557 | UpdateOrInsertStartFlag(deviceVec[0], false); | 557 | UpdateOrInsertStartFlag(deviceVec[0], false); |
| 558 | + AicpuSchedule::DumpSessionManager::GetInstance().CloseAllSessions(); | ||
| 558 | AicpuSchedule::AicpuMonitor::GetInstance().StopMonitor(); | 559 | AicpuSchedule::AicpuMonitor::GetInstance().StopMonitor(); |
| 559 | AicpuSchedule::AicpuEventManager::GetInstance().SetRunningFlag(false); | 560 | AicpuSchedule::AicpuEventManager::GetInstance().SetRunningFlag(false); |
| 560 | AicpuSchedule::AicpuSdPeriodStatistic::GetInstance().StopStatistic(); | 561 | AicpuSchedule::AicpuSdPeriodStatistic::GetInstance().StopStatistic(); |
| @@ -692,7 +692,7 @@ public: | |||
| 692 | DumpSessionManager() = default; | 692 | DumpSessionManager() = default; |
| 693 | ~DumpSessionManager() = default; | 693 | ~DumpSessionManager() = default; |
| 694 | 694 | ||
| 695 | - IDE_SESSION GetSession(int32_t hostPid, uint32_t devcieId); | 695 | + IDE_SESSION GetSession(int32_t hostPid, uint32_t deviceId); |
| 696 | IDE_SESSION ReacquireSession(int32_t hostPid, uint32_t deviceId); | 696 | IDE_SESSION ReacquireSession(int32_t hostPid, uint32_t deviceId); |
| 697 | void CloseAllSessions(); | 697 | void CloseAllSessions(); |
| 698 | IDE_SESSION CreateIdeDumpSession(int32_t hostPid, uint32_t deviceId) const; | 698 | IDE_SESSION CreateIdeDumpSession(int32_t hostPid, uint32_t deviceId) const; |
| @@ -224,6 +224,7 @@ int32_t StopAICPUScheduler(uint32_t deviceId, pid_t hostPid) | |||
| 224 | { | 224 | { |
| 225 | (void)AicpuSchedule::AicpuCustSoManager::GetInstance().DeleteCustSoDir(); | 225 | (void)AicpuSchedule::AicpuCustSoManager::GetInstance().DeleteCustSoDir(); |
| 226 | AicpuSchedule::OpDumpTaskManager::GetInstance().ClearResource(); | 226 | AicpuSchedule::OpDumpTaskManager::GetInstance().ClearResource(); |
| 227 | + AicpuSchedule::DumpSessionManager::GetInstance().CloseAllSessions(); | ||
| 227 | const std::vector<uint32_t> deviceVec = {deviceId}; | 228 | const std::vector<uint32_t> deviceVec = {deviceId}; |
| 228 | (void)AicpuSchedule::AicpuScheduleInterface::GetInstance().StopAICPUSchedulerWithFlag(deviceVec, hostPid, false); | 229 | (void)AicpuSchedule::AicpuScheduleInterface::GetInstance().StopAICPUSchedulerWithFlag(deviceVec, hostPid, false); |
| 229 | aicpusd_run_info("Successfully stopped AICPU scheduler, deviceId[%u], hostPid[%d].", deviceId, hostPid); | 230 | aicpusd_run_info("Successfully stopped AICPU scheduler, deviceId[%u], hostPid[%d].", deviceId, hostPid); |
| @@ -252,6 +252,41 @@ int32_t OpDumpTaskManager::LoadOpMappingInfo(const char_t * const infoAddr, cons | |||
| 252 | return AICPU_SCHEDULE_OK; | 252 | return AICPU_SCHEDULE_OK; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | +DumpSessionManager &DumpSessionManager::GetInstance() | ||
| 256 | +{ | ||
| 257 | + static DumpSessionManager instance; | ||
| 258 | + return instance; | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +IDE_SESSION DumpSessionManager::GetSession(int32_t hostPid, uint32_t deviceId) | ||
| 262 | +{ | ||
| 263 | + UNUSED(hostPid); | ||
| 264 | + UNUSED(deviceId); | ||
| 265 | + sessionsMap_.clear(); | ||
| 266 | + return nullptr; | ||
| 267 | +} | ||
| 268 | + | ||
| 269 | +IDE_SESSION DumpSessionManager::ReacquireSession(int32_t hostPid, uint32_t deviceId) | ||
| 270 | +{ | ||
| 271 | + UNUSED(hostPid); | ||
| 272 | + UNUSED(deviceId); | ||
| 273 | + sessionsMap_.clear(); | ||
| 274 | + return nullptr; | ||
| 275 | +} | ||
| 276 | + | ||
| 277 | +void DumpSessionManager::CloseAllSessions() | ||
| 278 | +{ | ||
| 279 | + sessionsMap_.clear(); | ||
| 280 | + return; | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | +IDE_SESSION DumpSessionManager::CreateIdeDumpSession(int32_t hostPid, uint32_t deviceId) const | ||
| 284 | +{ | ||
| 285 | + UNUSED(hostPid); | ||
| 286 | + UNUSED(deviceId); | ||
| 287 | + return nullptr; | ||
| 288 | +} | ||
| 289 | + | ||
| 255 | int32_t AicpuQueueEventProcess::ProcessQsMsg(const event_info &event) | 290 | int32_t AicpuQueueEventProcess::ProcessQsMsg(const event_info &event) |
| 256 | { | 291 | { |
| 257 | UNUSED(event); | 292 | UNUSED(event); |
| @@ -1,12 +1,12 @@ | |||
| 1 | /** | 1 | /** |
| 2 | - * Copyright (c) 2025 Huawei Technologies Co., Ltd. | 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 | 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"). | 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. | 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, | 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. | 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. | 8 | + * See LICENSE in the root of the software repository for the full text of the License. |
| 9 | - */ | 9 | + */ |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| @@ -89,8 +89,13 @@ TEST_F(HostCpuSchedulerStubSt, HostCpuSchedulerStubStSuccess) | |||
| 89 | TsdDestroy(0, type, 0, 0); | 89 | TsdDestroy(0, type, 0, 0); |
| 90 | StartupResponse(0, type, 0, 0); | 90 | StartupResponse(0, type, 0, 0); |
| 91 | WaitForShutDown(0); | 91 | WaitForShutDown(0); |
| 92 | - AicpuSchedule::OpDumpTaskManager::GetInstance().ClearResource(); | ||
| 93 | 92 | ||
| 93 | + AicpuSchedule::DumpSessionManager::GetInstance().GetSession(0, 0); | ||
| 94 | + AicpuSchedule::DumpSessionManager::GetInstance().ReacquireSession(0, 0); | ||
| 95 | + AicpuSchedule::DumpSessionManager::GetInstance().CloseAllSessions(); | ||
| 96 | + AicpuSchedule::DumpSessionManager::GetInstance().CreateIdeDumpSession(0, 0); | ||
| 97 | + | ||
| 98 | + AicpuSchedule::OpDumpTaskManager::GetInstance().ClearResource(); | ||
| 94 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfo(0, 0, 0, 0); | 99 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfo(0, 0, 0, 0); |
| 95 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfoForUnknowShape(0, 0); | 100 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfoForUnknowShape(0, 0); |
| 96 | AicpuSchedule::OpDumpTaskManager::GetInstance().LoadOpMappingInfo(nullptr, 0); | 101 | AicpuSchedule::OpDumpTaskManager::GetInstance().LoadOpMappingInfo(nullptr, 0); |
| @@ -89,6 +89,12 @@ TEST_F(HostCpuSchedulerStubUt, HostCpuSchedulerStubUtSuccess) | |||
| 89 | TsdDestroy(0, type, 0, 0); | 89 | TsdDestroy(0, type, 0, 0); |
| 90 | StartupResponse(0, type, 0, 0); | 90 | StartupResponse(0, type, 0, 0); |
| 91 | WaitForShutDown(0); | 91 | WaitForShutDown(0); |
| 92 | + | ||
| 93 | + AicpuSchedule::DumpSessionManager::GetInstance().GetSession(0, 0); | ||
| 94 | + AicpuSchedule::DumpSessionManager::GetInstance().ReacquireSession(0, 0); | ||
| 95 | + AicpuSchedule::DumpSessionManager::GetInstance().CloseAllSessions(); | ||
| 96 | + AicpuSchedule::DumpSessionManager::GetInstance().CreateIdeDumpSession(0, 0); | ||
| 97 | + | ||
| 92 | AicpuSchedule::OpDumpTaskManager::GetInstance().ClearResource(); | 98 | AicpuSchedule::OpDumpTaskManager::GetInstance().ClearResource(); |
| 93 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfo(0, 0, 0, 0); | 99 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfo(0, 0, 0, 0); |
| 94 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfoForUnknowShape(0, 0); | 100 | AicpuSchedule::OpDumpTaskManager::GetInstance().DumpOpInfoForUnknowShape(0, 0); |