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 { return isProfiling_; }
29 :
30 : // return flag of device list that needs report prof data is empty or not
31 : bool IsDeviceListEmpty() const;
32 : aclError AddDeviceList(const uint32_t* const deviceIdList, const uint32_t deviceNums);
33 : aclError RemoveDeviceList(const uint32_t* const deviceIdList, const uint32_t deviceNums);
34 : aclError RegisterProfilingType() const;
35 :
36 : private:
37 3 : ~AclProfilingManager() = default;
38 3 : AclProfilingManager() = default;
39 : bool isProfiling_ = false;
40 : std::mutex mutex_;
41 : std::unordered_set<uint32_t> deviceList_;
42 : };
43 :
44 : } // namespace acl
45 : #endif // ACL_PROFILING_MANAGER_H_
|