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 <string>
12 :
13 : #include "profiling_manager.h"
14 : #include "adapter_prof.h"
15 : #include "profiling_manager_pub.h"
16 :
17 : namespace hccl {
18 1 : HcclResult ProfilingManagerPub::CallMsprofReportMultiThreadInfo(const std::vector<uint32_t> &tidInfo)
19 : {
20 1 : return ProfilingManager::Instance().CallMsprofReportMultiThreadInfo(tidInfo);
21 : }
22 :
23 26 : bool ProfilingManagerPub::GetAdditionInfoState()
24 : {
25 26 : return ProfilingManager::Instance().GetAdditionInfoState();
26 : }
27 :
28 26 : bool ProfilingManagerPub::GetTaskApiState()
29 : {
30 26 : return ProfilingManager::Instance().GetTaskApiState();
31 : }
32 13 : HcclResult ProfilingManagerPub::CallMsprofReportHostApi(HcclCMDType cmdType, uint64_t beginTime, u64 count,
33 : HcclDataType dataType, AlgType algType, uint64_t groupName, u32 numBlocks)
34 : {
35 26 : return ProfilingManager::Instance().CallMsprofReportHostApi(cmdType, beginTime, count,
36 26 : dataType, algType, groupName, numBlocks);
37 : }
38 :
39 1 : HcclResult ProfilingManagerPub::CallMsprofReportMc2CommInfo(uint64_t timeStamp, const void *data, int len)
40 : {
41 1 : CHK_PTR_NULL(data);
42 1 : return ProfilingManager::Instance().CallMsprofReportMc2CommInfo(timeStamp, data, len);
43 : }
44 :
45 0 : HcclResult ProfilingManagerPub::CallMsprofReportHostNodeApi(uint64_t beginTime, uint64_t endTime,
46 : const std::string profName, uint32_t threadId)
47 : {
48 0 : uint64_t itemId = hrtMsprofGetHashId(profName.c_str(), profName.length());
49 :
50 0 : return ProfilingManager::Instance().CallMsprofReportHostNodeApi(beginTime, endTime, itemId, threadId);
51 : }
52 :
53 0 : HcclResult ProfilingManagerPub::CallMsprofReportHostNodeBasicInfo(uint64_t endTime, const std::string profName,
54 : uint32_t threadId)
55 : {
56 0 : uint64_t itemId = hrtMsprofGetHashId(profName.c_str(), profName.length());
57 :
58 0 : return ProfilingManager::Instance().CallMsprofReportHostNodeBasicInfo(endTime, itemId, threadId);
59 : }
60 :
61 3 : HcclResult ProfilingManagerPub::CallMsprofReportNodeInfo(uint64_t beginTime, uint64_t endTime,
62 : const std::string profName, uint32_t threadId)
63 : {
64 3 : return ProfilingManager::Instance().CallMsprofReportNodeInfo(beginTime, endTime, profName, threadId);
65 : }
66 :
67 551 : bool ProfilingManagerPub::GetAllState()
68 : {
69 551 : return ProfilingManager::Instance().GetAllState();
70 : }
71 :
72 234 : HcclResult ProfilingManagerPub::ClearStoragedProfilingInfo()
73 : {
74 234 : return ProfilingManager::Instance().ClearStoragedProfilingInfo();
75 : }
76 :
77 330 : void ProfilingManagerPub::SetThreadCaptureStatus(s32 threadID, bool isCapture)
78 : {
79 330 : ProfilingManager::Instance().SetThreadCaptureStatus(threadID, isCapture);
80 330 : }
81 :
82 0 : bool ProfilingManagerPub::GetThreadCaptureStatus()
83 : {
84 0 : return ProfilingManager::Instance().GetThreadCaptureStatus();
85 : }
86 :
87 302 : void ProfilingManagerPub::DeleteThreadCaptureStatus(s32 threadID)
88 : {
89 302 : ProfilingManager::Instance().DeleteThreadCaptureStatus(threadID);
90 302 : }
91 :
92 : }
|