LCOV - code coverage report
Current view: top level - adump/common/platform - cloud_v4_platform.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 31 31
Test Date: 2026-07-28 10:54:24 Functions: 100.0 % 13 13

            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 "cloud_v4_platform.h"
      11              : 
      12              : #include <string>
      13              : #include "adump_platform_registry.h"
      14              : #include "kernel_pc_fixer.h"
      15              : #include "register_config.h"
      16              : #include "dump_common.h"
      17              : #include "dump_core.h"
      18              : 
      19              : namespace Adx {
      20              : 
      21              : ADUMP_PLATFORM_REGISTER(FeaturesSupportInterface, PlatformType::CHIP_CLOUD_V4, CloudV4Features);
      22              : ADUMP_PLATFORM_REGISTER(CoredumpInterface, PlatformType::CHIP_CLOUD_V4, CloudV4Coredump);
      23              : ADUMP_PLATFORM_REGISTER(ExceptionDumpInterface, PlatformType::CHIP_CLOUD_V4, CloudV4Exception);
      24              : ADUMP_PLATFORM_REGISTER(DataDumpInterface, PlatformType::CHIP_CLOUD_V4, CloudV4DataDump);
      25              : 
      26              : namespace {
      27              : constexpr size_t ADX_MAX_AICORE_ON_ASCEND950 = 36U;
      28              : constexpr size_t ADX_MAX_STR_LEN = 1024U * 1024U;
      29              : }
      30              : 
      31            3 : CloudV4Features::CloudV4Features()
      32              : {
      33            3 :     supported_ = {
      34              :         AdumpPlatformFeature::FEATURE_DATA_DUMP,
      35              :         AdumpPlatformFeature::FEATURE_OVERFLOW_DUMP,
      36              :         AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L0,
      37              :         AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L1,
      38              :         AdumpPlatformFeature::FEATURE_CORE_DUMP,
      39            3 :     };
      40            3 : }
      41              : 
      42            6 : std::unique_ptr<PcFixerInterface> CloudV4Coredump::CreatePcFixer() const
      43              : {
      44            6 :     return std::unique_ptr<PcFixerInterface>(new (std::nothrow) CloudV4PcFixer());
      45              : }
      46              : 
      47           11 : std::shared_ptr<RegisterInterface> CloudV4Coredump::CreateRegister() const
      48              : {
      49           11 :     return std::make_shared<CloudV4Register>();
      50              : }
      51              : 
      52            8 : void CloudV4Coredump::DumpRegister(DumpCore& core, uint8_t coreType, uint16_t coreId) const
      53              : {
      54            8 :     core.DumpV4Register(coreType, coreId);
      55            8 : }
      56              : 
      57           26 : uint16_t CloudV4Coredump::ConvertCoreId(uint8_t coreType, uint16_t coreId) const
      58              : {
      59           26 :     return (coreType == CORE_TYPE_AIC) ? coreId : static_cast<uint16_t>(CORE_SIZE_AIC_DAVID + coreId);
      60              : }
      61              : 
      62            6 : bool CloudV4Exception::IsArgsDataTypeSizeByByte() const
      63              : {
      64            6 :     return false;
      65              : }
      66              : 
      67            6 : uint64_t CloudV4DataDump::GetKfcStackSize() const
      68              : {
      69            6 :     constexpr uint32_t OP_STACK_950 = 108;
      70            6 :     return CalcKfcStackSize(OP_STACK_950);
      71              : }
      72              : 
      73            3 : std::string CloudV4DataDump::GetKfcBinName() const
      74              : {
      75            6 :     return "kfc_dump_stat_ascend950.o";
      76              : }
      77              : 
      78            3 : bool CloudV4DataDump::IsUbFromAiCore() const
      79              : {
      80            3 :     return true;
      81              : }
      82              : 
      83            6 : size_t CloudV4DataDump::GetCoreTypeIDOffset() const
      84              : {
      85            6 :     return ADX_MAX_AICORE_ON_ASCEND950 * 2;
      86              : }
      87              : 
      88           25 : size_t CloudV4DataDump::GetBlockNum() const
      89              : {
      90           25 :     return ADX_MAX_AICORE_ON_ASCEND950 * 3;
      91              : }
      92              : 
      93            4 : int32_t CloudV4DataDump::GetStreamSyncTimeout() const
      94              : {
      95            4 :     constexpr int32_t ADX_DAVID_TIMEOUT = 60000 * 30;
      96            4 :     return ADX_DAVID_TIMEOUT;
      97              : }
      98              : 
      99           11 : bool CloudV4DataDump::IsSimtDumpEnabled(size_t dumpWorkSpaceSize) const
     100              : {
     101           11 :     return dumpWorkSpaceSize > GetBlockNum() * ADX_MAX_STR_LEN;
     102              : }
     103              : 
     104              : } // namespace Adx
        

Generated by: LCOV version 2.0-1