LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/resource_manager/notify/aicpu - queue_notify_lite_mgr.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 60.9 % 23 14
Test Date: 2026-08-04 10:52:23 Functions: 33.3 % 3 1

            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 "queue_notify_lite_mgr.h"
      11              : #include "binary_stream.h"
      12              : #include "log.h"
      13              : #include "stl_util.h"
      14              : 
      15              : namespace Hccl {
      16              : 
      17            0 : NotifyLite *QueueNotifyLiteMgr::Get(u32 postQId, u32 waitQId, u32 topicId)
      18              : {
      19            0 :     auto key = std::make_tuple(postQId, waitQId, topicId);
      20            0 :     if (!Contain(notifys, key)) {
      21            0 :         return nullptr;
      22              :     }
      23            0 :     HCCL_INFO("QueueNotifyLiteMgr::Get postQId [%u] waitQId [%u] topicId [%u]", postQId, waitQId, topicId);
      24            0 :     return notifys[key].get();
      25              : }
      26              : 
      27            0 : void QueueNotifyLiteMgr::Reset()
      28              : {
      29            0 :     notifys.clear();
      30            0 : }
      31              : 
      32              : constexpr u8 QUEUE_NOTIFY_POST_QID_POS = 0;
      33              : constexpr u8 QUEUE_NOTIFY_WAIT_QID_POS = 1;
      34              : constexpr u8 QUEUE_NOTIFY_TOPIC_ID_POS = 2;
      35              : 
      36            1 : void QueueNotifyLiteMgr::ParsePackedData(std::vector<char> &data)
      37              : {
      38              :     u32          poolSize;
      39            1 :     BinaryStream binaryStream(data);
      40            1 :     binaryStream >> poolSize;
      41              : 
      42            4 :     for (u32 idx = 0; idx < poolSize; idx++) {
      43            3 :         std::tuple<u32, u32, u32> key;
      44            3 :         binaryStream >> std::get<QUEUE_NOTIFY_POST_QID_POS>(key);
      45            3 :         binaryStream >> std::get<QUEUE_NOTIFY_WAIT_QID_POS>(key);
      46            3 :         binaryStream >> std::get<QUEUE_NOTIFY_TOPIC_ID_POS>(key);
      47            3 :         std::vector<char> uniqueId;
      48            3 :         binaryStream >> uniqueId;
      49            3 :         if (!Contain(notifys, key)) {
      50            3 :             notifys[key] = std::make_unique<NotifyLite>(uniqueId);
      51              :         }
      52            3 :     }
      53            1 : }
      54              : 
      55              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1