LCOV - code coverage report
Current view: top level - server - qs_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_QS_PROC_MEM_STATISTIC_H
      11              : #define STATISTIC_QS_PROC_MEM_STATISTIC_H
      12              : 
      13              : #include <string>
      14              : 
      15              : #include "common/type_def.h"
      16              : #include "common/bqs_log.h"
      17              : 
      18              : namespace bqs {
      19              :     struct ProcMemStatInfo {
      20              :         uint64_t memAvg;
      21              :         uint64_t memHwm;
      22              :         uint64_t statCnt;
      23              :         uint64_t memTotal;
      24           39 :         ProcMemStatInfo() : memAvg(0UL), memHwm(0UL), statCnt(0UL), memTotal(0UL) {}
      25              :     };
      26              : 
      27              :     class QsProcMemStatistic {
      28              :     public:
      29              :         QsProcMemStatistic();
      30              :         virtual ~QsProcMemStatistic();
      31              :         void StatisticProcMemInfo();
      32              :         bool InitProcMemStatistic();
      33              :         void PrintOutProcMemInfo(const uint32_t hostPid);
      34              :     private:
      35              :         void StatisticProcSvmMemInfo();
      36              :         void StatisticProcXsMemInfo();
      37              :         void StatisticProcOsMemInfo();
      38              :         bool GetXsMemInfoFromFile(uint64_t &xsMemValue);
      39              :         bool GetOsMemInfoFromFile(uint64_t &rssValue, uint64_t &hwmValue);
      40              :         bool GetSvmInfoFromFile(uint64_t &svmValue);
      41              :         ProcMemStatInfo rssMem_;
      42              :         ProcMemStatInfo svmMem_;
      43              :         ProcMemStatInfo xsMem_;
      44              :         std::string rssMemCfgFile_;
      45              :         std::string svmMemCfgFile_;
      46              :         std::string xsMemCfgFile_;
      47              :         bool runDevice_;
      48              :         pid_t curPid_;
      49              :     };
      50              : }
      51              : #endif
        

Generated by: LCOV version 2.0-1