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 :
11 : #include "dump_task.h"
12 : #include "aicpusd_status.h"
13 :
14 6 : int32_t AicpuGetOpTaskInfo(const KfcDumpTask& taskKey, KfcDumpInfo** ptr)
15 : {
16 6 : if (ptr == nullptr) {
17 1 : aicpusd_err(
18 : "Get op task info ptr is null! streamId[%u], taskId[%u], index[%u].", taskKey.streamId_, taskKey.taskId_,
19 : taskKey.index_);
20 1 : return AicpuSchedule::AICPU_SCHEDULE_ERROR_DUMP_FAILED;
21 : }
22 5 : AicpuSchedule::OpDumpTaskManager& opDumpTaskMgr = AicpuSchedule::OpDumpTaskManager::GetInstance();
23 5 : int32_t ret = opDumpTaskMgr.GetDumpOpTaskDataforKfc(taskKey, ptr);
24 5 : if (ret != AicpuSchedule::AICPU_SCHEDULE_OK) {
25 1 : aicpusd_err(
26 : "Get op task info failed! streamId[%u], taskId[%u], index[%u] ret[%d].", taskKey.streamId_, taskKey.taskId_,
27 : taskKey.index_, ret);
28 1 : return ret;
29 : }
30 4 : aicpusd_info(
31 : "Get op task info success, streamId[%u], taskId[%u], index[%u] ret[%d].", taskKey.streamId_, taskKey.taskId_,
32 : taskKey.index_, ret);
33 4 : return ret;
34 : }
35 :
36 6 : int32_t AicpuDumpOpTaskData(const KfcDumpTask& taskKey, void* dumpPtr, uint32_t length)
37 : {
38 6 : if (dumpPtr == nullptr) {
39 1 : aicpusd_err(
40 : "Result ptr of op task info is null! streamId[%u], taskId[%u], index[%u].", taskKey.streamId_,
41 : taskKey.taskId_, taskKey.index_);
42 1 : return AicpuSchedule::AICPU_SCHEDULE_ERROR_DUMP_FAILED;
43 : }
44 5 : if (length == 0U) {
45 0 : aicpusd_warn(
46 : "Result len of op task info is zero! streamId[%u], taskId[%u], index[%u].", taskKey.streamId_,
47 : taskKey.taskId_, taskKey.index_);
48 0 : return AicpuSchedule::AICPU_SCHEDULE_OK;
49 : }
50 5 : AicpuSchedule::OpDumpTaskManager& opDumpTaskMgr = AicpuSchedule::OpDumpTaskManager::GetInstance();
51 5 : int32_t ret = opDumpTaskMgr.DumpOpTaskDataforKfc(taskKey, dumpPtr, length);
52 5 : if (ret != AicpuSchedule::AICPU_SCHEDULE_OK) {
53 1 : aicpusd_err(
54 : "Dump op task data failed! streamId[%u], taskId[%u], index[%u], ret[%d].", taskKey.streamId_,
55 : taskKey.taskId_, taskKey.index_, ret);
56 1 : return ret;
57 : }
58 4 : aicpusd_info(
59 : "Dump op task data success, streamId[%u], taskId[%u], index[%u] length[%u].", taskKey.streamId_,
60 : taskKey.taskId_, taskKey.index_, length);
61 4 : return ret;
62 : }
|