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

Generated by: LCOV version 2.0-1