LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/transport/aicpu - mem_transport_lite.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 73.3 % 15 11
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 2 2

            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 "mem_transport_lite.h"
      12              : #include "ub_transport_lite_impl.h"
      13              : #include "p2p_transport_lite_impl.h"
      14              : #include "binary_stream.h"
      15              : #include "not_support_exception.h"
      16              : #include "internal_exception.h"
      17              : #include "exception_util.h"
      18              : namespace Hccl {
      19              : 
      20           54 : MemTransportLite::MemTransportLite(
      21           54 :     std::vector<char>& uniqueId, std::function<void(u32 streamId, u32 taskId, const TaskParam& taskParam)> callback)
      22              : {
      23           54 :     BinaryStream binaryStream(uniqueId);
      24              :     // 反序列化,得到type,基于type创建不同的 impl
      25              :     u32 theType;
      26           54 :     binaryStream >> theType;
      27           54 :     if (theType >= static_cast<u32>(TransportType::INVALID)) {
      28            0 :         THROW<InternalException>(StringFormat("type %u is error", theType));
      29              :     }
      30              : 
      31           54 :     type = static_cast<TransportType::Value>(theType);
      32              : 
      33           54 :     if (type == TransportType::UB) {
      34           54 :         impl = std::make_unique<UbTransportLiteImpl>(uniqueId, callback);
      35            0 :     } else if (type == TransportType::P2P) {
      36            0 :         impl = std::make_unique<P2PTransportLiteImpl>(uniqueId, callback);
      37              :     } else {
      38            0 :         THROW<NotSupportException>(StringFormat("%s doesnot support now", type.Describe().c_str()));
      39              :     }
      40           54 : }
      41              : 
      42            5 : std::string MemTransportLite::Describe() const
      43              : {
      44            5 :     return StringFormat("MemTransportLite[type=%s]", type.Describe().c_str());
      45              : }
      46              : 
      47              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1