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() { return ProfilingManager::Instance().GetAdditionInfoState(); }
24 :
25 26 : bool ProfilingManagerPub::GetTaskApiState() { return ProfilingManager::Instance().GetTaskApiState(); }
26 13 : HcclResult ProfilingManagerPub::CallMsprofReportHostApi(
27 : HcclCMDType cmdType, uint64_t beginTime, u64 count, HcclDataType dataType, AlgType algType, uint64_t groupName,
28 : u32 numBlocks)
29 : {
30 26 : return ProfilingManager::Instance().CallMsprofReportHostApi(
31 26 : cmdType, beginTime, count, dataType, algType, groupName, numBlocks);
32 : }
33 :
34 1 : HcclResult ProfilingManagerPub::CallMsprofReportMc2CommInfo(uint64_t timeStamp, const void* data, int len)
35 : {
36 1 : CHK_PTR_NULL(data);
37 1 : return ProfilingManager::Instance().CallMsprofReportMc2CommInfo(timeStamp, data, len);
38 : }
39 :
40 0 : HcclResult ProfilingManagerPub::CallMsprofReportHostNodeApi(
41 : uint64_t beginTime, uint64_t endTime, const std::string profName, uint32_t threadId)
42 : {
43 0 : uint64_t itemId = hrtMsprofGetHashId(profName.c_str(), profName.length());
44 :
45 0 : return ProfilingManager::Instance().CallMsprofReportHostNodeApi(beginTime, endTime, itemId, threadId);
46 : }
47 :
48 : HcclResult
49 0 : ProfilingManagerPub::CallMsprofReportHostNodeBasicInfo(uint64_t endTime, const std::string profName, uint32_t threadId)
50 : {
51 0 : uint64_t itemId = hrtMsprofGetHashId(profName.c_str(), profName.length());
52 :
53 0 : return ProfilingManager::Instance().CallMsprofReportHostNodeBasicInfo(endTime, itemId, threadId);
54 : }
55 :
56 3 : HcclResult ProfilingManagerPub::CallMsprofReportNodeInfo(
57 : uint64_t beginTime, uint64_t endTime, const std::string profName, uint32_t threadId)
58 : {
59 3 : return ProfilingManager::Instance().CallMsprofReportNodeInfo(beginTime, endTime, profName, threadId);
60 : }
61 :
62 552 : bool ProfilingManagerPub::GetAllState() { return ProfilingManager::Instance().GetAllState(); }
63 :
64 235 : HcclResult ProfilingManagerPub::ClearStoragedProfilingInfo()
65 : {
66 235 : return ProfilingManager::Instance().ClearStoragedProfilingInfo();
67 : }
68 :
69 330 : void ProfilingManagerPub::SetThreadCaptureStatus(s32 threadID, bool isCapture)
70 : {
71 330 : ProfilingManager::Instance().SetThreadCaptureStatus(threadID, isCapture);
72 330 : }
73 :
74 0 : bool ProfilingManagerPub::GetThreadCaptureStatus() { return ProfilingManager::Instance().GetThreadCaptureStatus(); }
75 :
76 302 : void ProfilingManagerPub::DeleteThreadCaptureStatus(s32 threadID)
77 : {
78 302 : ProfilingManager::Instance().DeleteThreadCaptureStatus(threadID);
79 302 : }
80 :
81 : } // namespace hccl
|