LCOV - code coverage report
Current view: top level - legacy/ascend950/common - log.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 93.9 % 33 31
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              : #include "log.h"
      11              : #include <dlog_pub.h>
      12              : 
      13              : namespace Hccl {
      14              : #ifndef CCL_KERNEL
      15        65995 : int HcclCheckLogLevel(int logLevel)
      16              : {
      17        65995 :     if (logLevel == HCCL_LOG_RUN_INFO) {
      18         1228 :         return CheckLogLevel(HCCL | RUN_LOG_MASK, DLOG_INFO);
      19              :     } else {
      20        64767 :         return CheckLogLevel(HCCL, logLevel);
      21              :     }
      22              : }
      23              : 
      24            0 : bool CheckDebugLogLevel()
      25              : {
      26            0 :     return CheckLogLevel(HCCL, DLOG_DEBUG) == 1;
      27              : }
      28              : 
      29            1 : bool CheckInfoLogLevel()
      30              : {
      31            1 :     return CheckLogLevel(HCCL, DLOG_INFO) == 1;
      32              : }
      33              : 
      34            2 : void CallDlogInvalidType(int level, int errCode, std::string file, int line)
      35              : {
      36            2 :     if (level == HCCL_LOG_RUN_INFO) {
      37            1 :         LOG_FUNC(static_cast<u32>(HCCL) | RUN_LOG_MASK, DLOG_INFO,
      38              :                  "[%s:%d][Log] Invalid LogType:Mod[%s],Type[%u]\n",
      39              :                  file.c_str(), line, "HCCL", errCode);
      40              :     } else {
      41            1 :         LOG_FUNC(HCCL, level,
      42              :                  "[%s:%d][Log] Invalid LogType:Mod[%s],Type[%u]\n",
      43              :                  file.c_str(), line, "HCCL", errCode);
      44              :     }
      45            2 : }
      46              : 
      47            7 : void CallDlogNoSzFormat(int level, int errCode, std::string file, int line)
      48              : {
      49            7 :     if (level == HCCL_LOG_RUN_INFO) {
      50            1 :         LOG_FUNC(static_cast<u32>(HCCL) | RUN_LOG_MASK, DLOG_INFO,
      51              :                  "[%s:%d]errNo[0x%016llx] ptr of szFormat is null\n",
      52              :                  file.c_str(), line, errCode);
      53              :     } else {
      54            6 :         LOG_FUNC(HCCL, level,
      55              :                  "[%s:%d]errNo[0x%016llx] ptr of szFormat is null\n",
      56              :                  file.c_str(), line, errCode);
      57              :     }
      58            7 : }
      59              : 
      60           20 : void CallDlogMemError(int level, std::string file, int line)
      61              : {
      62           20 :     if (level == HCCL_LOG_RUN_INFO) {
      63            1 :         LOG_FUNC(static_cast<u32>(HCCL) | RUN_LOG_MASK, DLOG_INFO,
      64              :                  "[%s:%d]memset stack log buffer to 0 failed.\n",
      65              :                  file.c_str(), line);
      66              :     } else {
      67           19 :         LOG_FUNC(HCCL, level,
      68              :                  "[%s:%d]memset stack log buffer to 0 failed.\n",
      69              :                  file.c_str(), line);
      70              :     }
      71           20 : }
      72              : 
      73            2 : void CallDlogPrintError(int level, std::string file, int line)
      74              : {
      75            2 :     if (level == HCCL_LOG_RUN_INFO) {
      76            1 :         LOG_FUNC(static_cast<u32>(HCCL) | RUN_LOG_MASK, DLOG_INFO,
      77              :                  "[%s:%d]snprintf_s failed.\n",
      78              :                  file.c_str(), line);
      79              :     } else {
      80            1 :         LOG_FUNC(HCCL, level,
      81              :                  "[%s:%d]snprintf_s failed.\n",
      82              :                  file.c_str(), line);
      83              :     }
      84            2 : }
      85              : 
      86        66267 : void CallDlog(int level, int sysCallBack, const char *buffer, std::string file, int line)
      87              : {
      88        66267 :     if (level == HCCL_LOG_RUN_INFO) {
      89         1228 :         LOG_FUNC(static_cast<u32>(HCCL) | RUN_LOG_MASK, DLOG_INFO,
      90              :                  "[%s:%d][%u]%s\n",
      91              :                  file.c_str(), line, sysCallBack, buffer);
      92              :     } else {
      93        65039 :         LOG_FUNC(HCCL, level,
      94              :                  "[%s:%d][%u]%s\n",
      95              :                  file.c_str(), line, sysCallBack, buffer);
      96              :     }
      97        66241 : }
      98              : #endif
      99              : }
        

Generated by: LCOV version 2.0-1