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-08-12 11:05:02 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              : 
      38              : private:
      39              :     void StatisticProcSvmMemInfo();
      40              :     void StatisticProcXsMemInfo();
      41              :     void StatisticProcOsMemInfo();
      42              :     bool GetXsMemInfoFromFile(uint64_t& xsMemValue);
      43              :     bool GetOsMemInfoFromFile(uint64_t& rssValue, uint64_t& hwmValue);
      44              :     bool GetSvmInfoFromFile(uint64_t& svmValue);
      45              :     ProcMemStatInfo rssMem_;
      46              :     ProcMemStatInfo svmMem_;
      47              :     ProcMemStatInfo xsMem_;
      48              :     std::string rssMemCfgFile_;
      49              :     std::string svmMemCfgFile_;
      50              :     std::string xsMemCfgFile_;
      51              :     DeployContext deployCtx_;
      52              :     pid_t curPid_;
      53              : };
      54              : } // namespace AicpuSchedule
      55              : #endif
        

Generated by: LCOV version 2.0-1