LCOV - code coverage report
Current view: top level - aicpu_schedule/statistic - aicpusd_proc_mem_statistic.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-07-28 10:54:05 Functions: 100.0 % 1 1

            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              : #ifndef STATISTIC_AICPUSD_PROC_MEM_STATISTIC_H
      11              : #define STATISTIC_AICPUSD_PROC_MEM_STATISTIC_H
      12              : 
      13              : #include <atomic>
      14              : #include <mutex>
      15              : #include <string>
      16              : #include <thread>
      17              : #include "aicpusd_status.h"
      18              : #include "aicpusd_common.h"
      19              : #include "aicpusd_context.h"
      20              : 
      21              : namespace AicpuSchedule {
      22              :     struct ProcMemStatInfo {
      23              :         uint64_t memAvg;
      24              :         uint64_t memHwm;
      25              :         uint64_t statCnt;
      26              :         uint64_t memTotal;
      27           36 :         ProcMemStatInfo() : memAvg(0UL), memHwm(0UL), statCnt(0UL), memTotal(0UL) {}
      28              :     };
      29              : 
      30              :     class AicpuSdProcMemStatistic {
      31              :     public:
      32              :         AicpuSdProcMemStatistic();
      33              :         virtual ~AicpuSdProcMemStatistic();
      34              :         void StatisticProcMemInfo();
      35              :         bool InitProcMemStatistic();
      36              :         void PrintOutProcMemInfo(const uint32_t hostPid);
      37              :     private:
      38              :         void StatisticProcSvmMemInfo();
      39              :         void StatisticProcXsMemInfo();
      40              :         void StatisticProcOsMemInfo();
      41              :         bool GetXsMemInfoFromFile(uint64_t &xsMemValue);
      42              :         bool GetOsMemInfoFromFile(uint64_t &rssValue, uint64_t &hwmValue);
      43              :         bool GetSvmInfoFromFile(uint64_t &svmValue);
      44              :         ProcMemStatInfo rssMem_;
      45              :         ProcMemStatInfo svmMem_;
      46              :         ProcMemStatInfo xsMem_;
      47              :         std::string rssMemCfgFile_;
      48              :         std::string svmMemCfgFile_;
      49              :         std::string xsMemCfgFile_;
      50              :         DeployContext deployCtx_;
      51              :         pid_t curPid_;
      52              :     };
      53              : }
      54              : #endif
        

Generated by: LCOV version 2.0-1