LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/notify - rts_1ton_cnt_notify.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 85.7 % 28 24
Test Date: 2026-08-18 17:47:01 Functions: 77.8 % 9 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              : 
      11              : #include "rts_1ton_cnt_notify.h"
      12              : #include "exception_util.h"
      13              : #include "task.h"
      14              : 
      15              : namespace Hccl {
      16              : 
      17           16 : Rts1ToNCntNotify::Rts1ToNCntNotify()
      18           16 :     : deviceId(HrtGetDevice()),
      19           16 :       devPhyId(HrtGetDevicePhyIdByIndex(HrtGetDevice())),
      20           16 :       handle(HrtCntNotifyCreate(deviceId)),
      21           16 :       id(HrtGetCntNotifyId(handle))
      22           16 : {}
      23              : 
      24           16 : Rts1ToNCntNotify::~Rts1ToNCntNotify() { DECTOR_TRY_CATCH("Rts1ToNCntNotify", HrtCntNotifyDestroy(handle)); }
      25              : 
      26            0 : std::unique_ptr<BaseTask> Rts1ToNCntNotify::WaitBits(u32 bitValue)
      27              : {
      28            0 :     return std::make_unique<TaskWaitBits>(this, bitValue);
      29              : }
      30              : 
      31            0 : std::unique_ptr<BaseTask> Rts1ToNCntNotify::PostValue(u32 value)
      32              : {
      33            0 :     return std::make_unique<TaskPostValue>(this, value);
      34              : }
      35              : 
      36           12 : void Rts1ToNCntNotify::WaitBits(u32 bitValue, u32 timeout, const Stream& stream) const
      37              : {
      38           12 :     HrtCntNotifyWaitWithTimeOut(handle, stream.GetPtr(), HrtCntNotifyWaitMode::BITMAP, bitValue, timeout);
      39           12 : }
      40              : 
      41            7 : void Rts1ToNCntNotify::PostValue(u32 value, const aclrtStream& rtStream) const
      42              : {
      43            7 :     HrtCntNotifyRecord(handle, rtStream, HrtCntNotifyRecordMode::STORE, value);
      44            7 : }
      45              : 
      46            4 : void Rts1ToNCntNotify::PostValue(u32 value, const Stream& stream) const { PostValue(value, stream.GetPtr()); }
      47              : 
      48            1 : std::string Rts1ToNCntNotify::Describe() const
      49              : {
      50            1 :     return StringFormat("Rts1ToNCntNotify[handle=%p, id=%d]", handle, id);
      51              : }
      52              : 
      53            5 : std::vector<char> Rts1ToNCntNotify::GetUniqueId() const
      54              : {
      55            5 :     BinaryStream binaryStream;
      56            5 :     binaryStream << id;
      57            5 :     binaryStream << devPhyId;
      58            5 :     std::vector<char> result;
      59            5 :     binaryStream.Dump(result);
      60            5 :     return result;
      61            5 : }
      62              : 
      63              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1