LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/common - hccp_hdc_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
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              : #ifndef HCCLV2_HCCP_HDC_MANAGER_H
      12              : #define HCCLV2_HCCP_HDC_MANAGER_H
      13              : #include <set>
      14              : #include <mutex>
      15              : #include <atomic>
      16              : #include "orion_adapter_hccp.h"
      17              : namespace Hccl {
      18              : class HccpHdcManager {
      19              : public:
      20              :     static HccpHdcManager& GetInstance();
      21              :     void Init(u32 deviceLogicId);
      22              :     void DeInit(u32 deviceLogicId);
      23              :     HccpHdcManager(const HccpHdcManager& hccpHdcManager) = delete;
      24              :     HccpHdcManager& operator=(const HccpHdcManager& hccpHdcManager) = delete;
      25              :     // 测试使用,待修改: 添加编译宏,仅在单元测试时提供此接口
      26            4 :     std::set<u32> GetSet() { return instances; }
      27              :     ~HccpHdcManager();
      28              : 
      29              : private:
      30              :     std::set<u32> instances; // key: deviceLogicId
      31              :     std::recursive_mutex managerMutex;
      32              :     std::atomic<bool> destroyed{false};
      33            3 :     HccpHdcManager() = default;
      34              :     void DestroyAll();
      35              :     void UnregisterDeviceResetCallback() const;
      36              : };
      37              : } // namespace Hccl
      38              : #endif // HCCLV2_HCCP_HDC_MANAGER_H
        

Generated by: LCOV version 2.0-1