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 % 26 26
Test Date: 2026-08-31 10:09:28 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 uint32_t MAX_AIC_CORE_COUNT = 36U;
      28              : constexpr uint32_t MAX_AIV_CORE_COUNT = 72U;
      29              : constexpr uint32_t MAX_ALL_CORE_COUNT = MAX_AIC_CORE_COUNT + MAX_AIV_CORE_COUNT;
      30              : constexpr size_t ADX_MAX_STR_LEN = 1024U * 1024U;
      31              : } // namespace
      32              : 
      33            3 : CloudV4Features::CloudV4Features()
      34              : {
      35              :     supported_ = {
      36              :         AdumpPlatformFeature::FEATURE_DATA_DUMP,         AdumpPlatformFeature::FEATURE_OVERFLOW_DUMP,
      37              :         AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L0, 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           12 :     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           11 : void CloudV4Coredump::DumpRegister(DumpCore& core, uint8_t coreType, uint16_t coreId) const
      53              : {
      54           11 :     core.DumpV4Register(coreType, coreId);
      55           11 : }
      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>(MAX_AIC_CORE_COUNT + coreId);
      60              : }
      61              : 
      62            9 : bool CloudV4Exception::IsArgsDataTypeSizeByByte() const { return false; }
      63              : 
      64            6 : uint64_t CloudV4DataDump::GetKfcStackSize() const
      65              : {
      66            6 :     constexpr uint32_t op_stack_count = MAX_ALL_CORE_COUNT;
      67            6 :     return CalcKfcStackSize(op_stack_count);
      68              : }
      69              : 
      70            3 : std::vector<std::string> CloudV4DataDump::GetKfcBinNames() const
      71              : {
      72            9 :     return {"dump_stat_op_ascend950.o", "kfc_dump_stat_ascend950.o"};
      73              : }
      74              : 
      75            6 : bool CloudV4DataDump::IsUbFromAiCore() const { return true; }
      76              : 
      77            6 : size_t CloudV4DataDump::GetCoreTypeIDOffset() const { return MAX_AIV_CORE_COUNT; }
      78              : 
      79           25 : size_t CloudV4DataDump::GetBlockNum() const { return MAX_ALL_CORE_COUNT; }
      80              : 
      81            7 : int32_t CloudV4DataDump::GetStreamSyncTimeout() const
      82              : {
      83            7 :     constexpr int32_t ADX_DAVID_TIMEOUT = 60000 * 30;
      84            7 :     return ADX_DAVID_TIMEOUT;
      85              : }
      86              : 
      87           17 : bool CloudV4DataDump::IsSimtDumpEnabled(size_t dumpWorkSpaceSize) const
      88              : {
      89           17 :     return dumpWorkSpaceSize > GetBlockNum() * ADX_MAX_STR_LEN;
      90              : }
      91              : 
      92              : } // namespace Adx
        

Generated by: LCOV version 2.0-1