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