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 ACL_PROFILING_MANAGER_H_ 12 : #define ACL_PROFILING_MANAGER_H_ 13 : 14 : #include <mutex> 15 : #include <unordered_set> 16 : #include <map> 17 : #include "common/log_inner.h" 18 : 19 : namespace acl { 20 : class AclProfilingManager final { 21 : public: 22 : static AclProfilingManager &GetInstance(); 23 : // init acl prof module 24 : aclError Init(); 25 : // uninit acl prof module 26 : aclError UnInit(); 27 : // acl profiling module is running or not 28 1 : bool AclProfilingIsRun() const 29 : { 30 1 : return isProfiling_; 31 : } 32 : 33 : // return flag of device list that needs report prof data is empty or not 34 : bool IsDeviceListEmpty() const; 35 : aclError AddDeviceList(const uint32_t *const deviceIdList, const uint32_t deviceNums); 36 : aclError RemoveDeviceList(const uint32_t *const deviceIdList, const uint32_t deviceNums); 37 : aclError RegisterProfilingType() const; 38 : 39 : private: 40 3 : ~AclProfilingManager() = default; 41 3 : AclProfilingManager() = default; 42 : bool isProfiling_ = false; 43 : std::mutex mutex_; 44 : std::unordered_set<uint32_t> deviceList_; 45 : }; 46 : 47 : } // namespace acl/ ACL_PROFILING_MANAGER_H_ 48 : #endif // ACL_PROFILING_MANAGER_H_