LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/dfx/common - profiling_common.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 83.3 % 6 5
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 1 1

            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              : #ifndef PROFILING_COMMON_H
      12              : #define PROFILING_COMMON_H
      13              : #include <map>
      14              : #include <string>
      15              : 
      16              : #include "task_param.h"
      17              : #include "enum_factory_legacy.h"
      18              : 
      19              : namespace Hccl {
      20              : 
      21              : MAKE_ENUM(
      22              :     HcclWorkflowMode, HCCL_WORKFLOW_MODE_OPS_KERNEL_INFO_LIB = 0, HCCL_WORKFLOW_MODE_OP_BASE = 1,
      23              :     HCCL_WORKFLOW_MODE_RESERVED)
      24              : 
      25              : MAKE_ENUM(SimpleTaskType, SDMA = 0, RDMA, LOCAL, UB, ROCE)
      26              : 
      27              : MAKE_ENUM(TaskRole, DST = 0, SRC)
      28              : 
      29              : const std::map<TaskParamType, std::string> PROF_TASK_OP_NAME_V2 = {
      30              :     {TaskParamType::TASK_SDMA, "Memcpy"},
      31              :     {TaskParamType::TASK_RDMA, "RDMASend"},
      32              :     {TaskParamType::TASK_REDUCE_INLINE, "Reduce_Inline"},
      33              :     {TaskParamType::TASK_REDUCE_TBE, "Reduce_TBE"},
      34              :     {TaskParamType::TASK_NOTIFY_RECORD, "Notify_Record"},
      35              :     {TaskParamType::TASK_NOTIFY_WAIT, "Notify_Wait"},
      36              :     {TaskParamType::TASK_SEND_NOTIFY, "Send_Notify"},
      37              :     {TaskParamType::TASK_SEND_PAYLOAD, "Send_Payload"},
      38              :     {TaskParamType::TASK_WRITE_WITH_NOTIFY, "Write_With_Notify"},
      39              :     {TaskParamType::TASK_UB_INLINE_WRITE, "Ub_Inline_Write"},
      40              :     {TaskParamType::TASK_UB_REDUCE_INLINE, "Ub_Reduce_Inline"},
      41              :     {TaskParamType::TASK_UB, "Ub_Write_Or_Read"},
      42              :     {TaskParamType::TASK_WRITE_REDUCE_WITH_NOTIFY, "Reuce_With_Notify"},
      43              :     {TaskParamType::TASK_CCU, "Ccu"},
      44              :     {TaskParamType::TASK_AICPU_KERNEL, "AicpuKernel"},
      45              :     {TaskParamType::TASK_AICPU_REDUCE, "Aicpu_Reduce"},
      46              :     {TaskParamType::TASK_AIV, "AivKernel"},
      47              :     {TaskParamType::TASK_DPU_KERNEL, "DpuKernel"},
      48              :     {TaskParamType::TASK_DPU_THREAD_FENCE, "Dpu_ThreadFence"},
      49              :     {TaskParamType::TASK_DPU_CHANNEL_FENCE, "Dpu_ChannelFence"},
      50              :     {TaskParamType::TASK_DPU_INLINE_WRITE, "Dpu_Notify_Record"},
      51              :     {TaskParamType::TASK_DPU_NOTIFY_WAIT, "Dpu_Notify_Wait"},
      52              :     {TaskParamType::TASK_DPU_WRITE_WITH_NOTIFY, "Dpu_Write_With_Notify"},
      53              : };
      54              : 
      55           20 : inline std::string GetProfTaskOpNameV2(TaskParamType type)
      56              : {
      57           20 :     CHK_PRT_RET(PROF_TASK_OP_NAME_V2.empty(), HCCL_ERROR("PROF_TASK_OP_NAME_V2 has not inited."), "invalid");
      58           20 :     auto it = PROF_TASK_OP_NAME_V2.find(type);
      59           20 :     if (it != PROF_TASK_OP_NAME_V2.end()) {
      60           20 :         return it->second;
      61              :     }
      62            0 :     return "unknown";
      63              : }
      64              : 
      65              : } // namespace Hccl
      66              : 
      67              : #endif // PROFILING_COMMON_H
        

Generated by: LCOV version 2.0-1