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 QUEUE_SCHEDULE_MSPROF_API_ADAPTER_H
12 : #define QUEUE_SCHEDULE_MSPROF_API_ADAPTER_H
13 :
14 : #include "toolchain/prof_api.h"
15 : #include "common/bqs_so_manager.h"
16 :
17 : namespace bqs {
18 :
19 : enum class ProfStatus : int32_t {
20 : PROF_SUCCESS,
21 : PROF_FAIL,
22 : PROF_INVALID_PARA,
23 : PROF_MSPROF_INNER_ERROR,
24 : PROF_MSPROF_API_NULLPTR
25 : };
26 :
27 : class BqsMsprofApiAdapter : public SoManager {
28 : public:
29 : BqsMsprofApiAdapter();
30 8 : ~BqsMsprofApiAdapter() = default;
31 :
32 : static BqsMsprofApiAdapter &GetInstance();
33 : ProfStatus MsprofInit(uint32_t dataType, void *data, uint32_t dataLen) const;
34 : ProfStatus MsprofFinalize() const;
35 : ProfStatus MsprofRegTypeInfo(uint16_t level, uint32_t typeId, const char *typeName) const;
36 : ProfStatus MsprofRegisterCallback(uint32_t moduleId, ProfCommandHandle handle) const;
37 : ProfStatus MsprofReportApi(uint32_t agingFlag, const MsprofApi *api) const;
38 : ProfStatus MsprofReportEvent(uint32_t agingFlag, const MsprofEvent *event) const;
39 : uint64_t MsprofSysCycleTime() const;
40 :
41 : private:
42 : BqsMsprofApiAdapter(const BqsMsprofApiAdapter &) = delete;
43 : BqsMsprofApiAdapter &operator=(const BqsMsprofApiAdapter &) = delete;
44 : BqsMsprofApiAdapter(BqsMsprofApiAdapter &&) = delete;
45 : BqsMsprofApiAdapter &operator=(BqsMsprofApiAdapter &&) = delete;
46 : };
47 : } // namespace bqs
48 :
49 : #endif // QUEUE_SCHEDULE_MSPROF_API_ADAPTER_H
|