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 : #include "hcclCommProfilingLite.h"
11 : #include "profiling_reporter_lite.h"
12 : #include "mirror_task_manager_lite.h"
13 :
14 : namespace hccl {
15 : // 构造函数
16 43 : HcclCommProfilingLite::HcclCommProfilingLite(Hccl::DevId deviceId, Hccl::MirrorTaskManagerLite* mirrorTaskManagerLite)
17 43 : : mirrorTaskManagerLite_(mirrorTaskManagerLite) { (void)deviceId; }
18 :
19 36 : HcclResult HcclCommProfilingLite::Init() {
20 36 : if (initializedFlag_) {
21 1 : return HCCL_SUCCESS;
22 : }
23 35 : CHK_RET(Hccl::ProfilingHandlerLite::GetInstance().Init());
24 35 : profilingReporterLite_ = std::make_unique<Hccl::ProfilingReporterLite>(
25 35 : mirrorTaskManagerLite_, &Hccl::ProfilingHandlerLite::GetInstance(), true);
26 35 : CHK_RET(profilingReporterLite_->Init());
27 35 : initializedFlag_ = true;
28 35 : return HCCL_SUCCESS;
29 : }
30 :
31 : // HcclCommProfilingLite任务上报
32 2 : void HcclCommProfilingLite::ReportAllTasks() {
33 2 : profilingReporterLite_->ReportAllTasks();
34 2 : }
35 :
36 2 : void HcclCommProfilingLite::UpdateProfStat() {
37 2 : profilingReporterLite_->UpdateProfStat();
38 2 : }
39 :
40 2 : Hccl::MirrorTaskManagerLite* HcclCommProfilingLite::GetMirrorTaskManagerLite() const {
41 2 : return mirrorTaskManagerLite_;
42 : }
43 : }
|