LCOV - code coverage report
Current view: top level - legacy/ascend910/common/debug/profiling - adapter_prof.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 88.1 % 42 37
Test Date: 2026-08-04 10:52:23 Functions: 87.5 % 8 7

            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 "adapter_prof.h"
      12              : #include "externalinput_pub.h"
      13              : #include "dlrt_function.h"
      14              : using namespace hccl;
      15              : 
      16            0 : HcclResult hrtMsprofRegisterCallback(uint32_t moduleId, ProfCommandHandle handle)
      17              : {
      18            0 :     s32 ret = DlProfFunction::GetInstance().dlMsprofRegisterCallback(moduleId, handle);
      19            0 :     HCCL_INFO("Call MsprofRegisterCallback, return value[%d], Params: moduleId[%u]", ret, moduleId);
      20            0 :     CHK_PRT_RET(ret != 0,
      21              :         HCCL_ERROR("[Register][CtrlCallback]MsprofRegisterCallback fail, return[%d], moduleId[%u]", ret, moduleId),
      22              :         HCCL_E_PROFILING);
      23            0 :     return HCCL_SUCCESS;
      24              : }
      25              : 
      26           84 : HcclResult hrtMsprofRegTypeInfo(uint16_t level, uint32_t typeId, const char *typeName)
      27              : {
      28           84 :     s32 ret = DlProfFunction::GetInstance().dlMsprofRegTypeInfo(level, typeId, typeName);
      29           84 :     HCCL_INFO("Call MsprofRegTypeInfo, return value[%d], Params: typeId[%u] typeName = [%s]", ret, typeId, typeName);
      30           84 :     CHK_PRT_RET(ret != 0, HCCL_ERROR("Call MsprofRegTypeInfo fail, return[%d]", ret), HCCL_E_PROFILING);
      31           84 :     return HCCL_SUCCESS;
      32              : }
      33              : 
      34           53 : HcclResult hrtMsprofReportApi(uint32_t agingFlag, const MsprofApi *api)
      35              : {
      36           53 :     s32 ret = DlProfFunction::GetInstance().dlMsprofReportApi(agingFlag, api);
      37           53 :     HCCL_INFO("Call MsprofReportApi, return value[%d], Params: agingFlag[%u]", ret, agingFlag);
      38           53 :     CHK_PRT_RET(ret != 0, HCCL_ERROR("Call MsprofReportApi fail, return[%d]", ret), HCCL_E_PROFILING);
      39           53 :     return HCCL_SUCCESS;
      40              : }
      41              : 
      42            1 : HcclResult hrtMsprofReportCompactInfo(uint32_t agingFlag, const VOID_PTR data, uint32_t length)
      43              : {
      44            1 :     s32 ret = DlProfFunction::GetInstance().dlMsprofReportCompactInfo(agingFlag, data, length);
      45            1 :     HCCL_INFO("Call MsprofReportCompactInfo, return value[%d], Params: agingFlag[%u]", ret, agingFlag);
      46            1 :     CHK_PRT_RET(ret != 0, HCCL_ERROR("Call MsprofReportCompactInfo fail, return[%d]", ret), HCCL_E_PROFILING);
      47            1 :     return HCCL_SUCCESS;
      48              : }
      49              : 
      50           48 : HcclResult hrtMsprofReportAdditionalInfo(uint32_t agingFlag, const VOID_PTR data, uint32_t length)
      51              : {
      52           48 :     s32 ret = DlProfFunction::GetInstance().dlMsprofReportAdditionalInfo(agingFlag, data, length);
      53           48 :     HCCL_INFO("Call MsprofReportAdditionalInfo, return value[%d], Params: agingFlag[%u]", ret, agingFlag);
      54           48 :     CHK_PRT_RET(ret != 0, HCCL_ERROR("Call MsprofReportAdditionalInfo fail, return[%d]", ret), HCCL_E_PROFILING);
      55           48 :     return HCCL_SUCCESS;
      56              : }
      57              : 
      58        15596 : uint64_t hrtMsprofGetHashId(const char *hashInfo, uint32_t length)
      59              : {
      60        15596 :     if (hashInfo == nullptr || length == 0) {
      61           12 :         HCCL_WARNING("HashData hashInfo is empty.");
      62           12 :         return INVALID_U64;
      63              :     }
      64        15584 :     u64 ret =  DlProfFunction::GetInstance().dlMsprofStr2Id(hashInfo, length);
      65        15584 :     return ret;
      66              : }
      67              : 
      68          402 : uint64_t hrtMsprofSysCycleTime(void)
      69              : {
      70          402 :     if (!GetIfProfile()) {
      71          317 :         return 0;
      72              :     }
      73           85 :     u64 ret = DlProfFunction::GetInstance().dlMsprofSysCycleTime();
      74           85 :     HCCL_DEBUG("Call MsprofSysCycleTime, return value[%u]", ret);
      75           85 :     return ret;
      76              : }
      77              : 
      78            1 : HcclResult hrtProfRegisterCtrlCallback(uint32_t logId, rtProfCtrlHandle callback)
      79              : {
      80            1 :     rtError_t ret = DlRtFunction::GetInstance().dlrtProfRegisterCtrlCallback(logId, callback);
      81            1 :     HCCL_DEBUG("Call rtProfRegisterCtrlCallback, return value[%d], Params: logId[%u].", ret, logId);
      82            1 :     CHK_PRT_RET(ret != RT_ERROR_NONE, HCCL_ERROR("[Register][CtrlCallback]errNo[0x%016llx] rtProf Register CtrlCallback"
      83              :         " fail, return[%d], rt logId[%u]", HCCL_ERROR_CODE(HCCL_E_RUNTIME), ret, logId), HCCL_E_RUNTIME);
      84            1 :     return HCCL_SUCCESS;
      85              : }
        

Generated by: LCOV version 2.0-1