LCOV - code coverage report
Current view: top level - coll_communicator_mgr/dfx/profiling/host - hcclCommProfiling.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 80.0 % 35 28
Test Date: 2026-08-04 10:52:23 Functions: 88.9 % 9 8

            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 "hcclCommProfiling.h"
      11              : #include "profiling_reporter.h"
      12              : #include "profiling_handler.h"
      13              : #include "../../../../legacy/ascend950/framework/dfx/profiling/dlprof_function.h"
      14              : namespace hccl {
      15              : 
      16            0 : HcclResult HcclCommProfiling::ReportKernel(uint64_t beginTime, const std::string& commTag, const std::string& kernelName, uint32_t threadId, bool cachedReq) const {
      17            0 :     u64 endTime = Hccl::DlProfFunction::GetInstance().dlMsprofSysCycleTime();
      18            0 :     uint64_t cmdItemId = Hccl::DlProfFunction::GetInstance().dlMsprofStr2Id(kernelName.c_str(), kernelName.length());
      19            0 :     EXCEPTION_CATCH(Hccl::ProfilingHandler::GetInstance().ReportNodeApi(beginTime, endTime, cmdItemId, threadId, cachedReq), return HCCL_E_PTR);
      20            0 :     EXCEPTION_CATCH(Hccl::ProfilingHandler::GetInstance().ReportNodeBasicInfo(endTime, cmdItemId, threadId, cachedReq), return HCCL_E_PTR);
      21            0 :     HCCL_INFO("[HcclCommProfiling][ReportKernel] beginTime [%llu] endTime[%llu] kernelName[%s] commTag[%s] threadId[%u]",
      22              :             beginTime, endTime, kernelName.c_str(), commTag.c_str(), threadId);
      23            0 :     return HCCL_SUCCESS;
      24              : }
      25              : 
      26          143 : HcclCommProfiling::HcclCommProfiling(u32 deviceId, Hccl::MirrorTaskManager* mirrorTaskManager)
      27          143 :     : mirrorTaskManager_(mirrorTaskManager) { (void)deviceId; }
      28              : 
      29          132 : HcclResult HcclCommProfiling::Init() {
      30          132 :     if (initializedFlag_) {
      31            1 :         return HCCL_SUCCESS;
      32              :     }
      33          131 :     CHK_RET(Hccl::ProfilingHandler::GetInstance().Init());
      34          131 :     profilingReporter_ = std::make_unique<Hccl::ProfilingReporter>(mirrorTaskManager_, &Hccl::ProfilingHandler::GetInstance());
      35          131 :     CHK_RET(profilingReporter_->Init());
      36          131 :     initializedFlag_ = true;
      37          131 :     return HCCL_SUCCESS;
      38              : }
      39              : 
      40              : // HcclCommProfiling任务上报
      41          100 : void HcclCommProfiling::ReportAllTasks(bool cachedReq) const {
      42          100 :     profilingReporter_->ReportAllTasks(cachedReq);
      43          100 : }
      44              : 
      45              : // HcclCommProfiling::ReportOp实现
      46            2 : void HcclCommProfiling::ReportOp(uint64_t beginTime, bool cachedReq, bool opbased) {
      47            2 :     profilingReporter_->ReportOp(beginTime, cachedReq, opbased);
      48            2 : }
      49              : 
      50            7 : void HcclCommProfiling::ReportMc2CommInfo(const Mc2CommInfo& mc2CommInfo) {
      51            7 :     profilingReporter_->CallReportMc2CommInfo(mc2CommInfo.FreeStreamId, mc2CommInfo.streamsId, 
      52            7 :         mc2CommInfo.groupname, mc2CommInfo.myRankId, mc2CommInfo.rankSize, mc2CommInfo.parentRankId);
      53            7 : }
      54              : 
      55            2 : void HcclCommProfiling::SetCurrDfxOpInfo(std::shared_ptr<Hccl::DfxOpInfo> dfxOpInfo)
      56              : {
      57            2 :     profilingReporter_->SetCurrDfxOpInfo(dfxOpInfo);
      58            2 : }
      59              : 
      60              : // HcclCommProfiling::UpdateProfStat实现
      61            2 : void HcclCommProfiling::UpdateProfStat() {
      62            2 :     profilingReporter_->UpdateProfStat();
      63            2 : }
      64            2 : Hccl::MirrorTaskManager* HcclCommProfiling::GetMirrorTaskManager() const {
      65            2 :     return mirrorTaskManager_;
      66              : }
      67              : }// namespace hccl
        

Generated by: LCOV version 2.0-1