106f6ba60Sopenharmony_ci/* 206f6ba60Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 306f6ba60Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 406f6ba60Sopenharmony_ci * you may not use this file except in compliance with the License. 506f6ba60Sopenharmony_ci * You may obtain a copy of the License at 606f6ba60Sopenharmony_ci * 706f6ba60Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 806f6ba60Sopenharmony_ci * 906f6ba60Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1006f6ba60Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1106f6ba60Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1206f6ba60Sopenharmony_ci * See the License for the specific language governing permissions and 1306f6ba60Sopenharmony_ci * limitations under the License. 1406f6ba60Sopenharmony_ci */ 1506f6ba60Sopenharmony_ci#ifndef RAM_H 1606f6ba60Sopenharmony_ci#define RAM_H 1706f6ba60Sopenharmony_ci#include "sp_profiler.h" 1806f6ba60Sopenharmony_ci#include <string> 1906f6ba60Sopenharmony_ci 2006f6ba60Sopenharmony_cienum { 2106f6ba60Sopenharmony_ci RAM_ONE = 1, 2206f6ba60Sopenharmony_ci RAM_SECOND, 2306f6ba60Sopenharmony_ci RAM_THIRD, 2406f6ba60Sopenharmony_ci RAM_FOURTH, 2506f6ba60Sopenharmony_ci RAM_FIFTH, 2606f6ba60Sopenharmony_ci RAM_SIXTH, 2706f6ba60Sopenharmony_ci RAM_SEVENTH, 2806f6ba60Sopenharmony_ci RAM_EIGHTH, 2906f6ba60Sopenharmony_ci RAM_NINTH, 3006f6ba60Sopenharmony_ci RAM_TENTH, 3106f6ba60Sopenharmony_ci}; 3206f6ba60Sopenharmony_ci 3306f6ba60Sopenharmony_cinamespace OHOS { 3406f6ba60Sopenharmony_cinamespace SmartPerf { 3506f6ba60Sopenharmony_ciclass RAM : public SpProfiler { 3606f6ba60Sopenharmony_cipublic: 3706f6ba60Sopenharmony_ci std::map<std::string, std::string> GetSysRamInfo() const; 3806f6ba60Sopenharmony_ci std::map<std::string, std::string> GetRamInfo() const; 3906f6ba60Sopenharmony_ci std::map<std::string, std::string> GetPssRamInfo(FILE *fd, std::vector<std::string> paramsInfo) const; 4006f6ba60Sopenharmony_ci std::map<std::string, std::string> ParsePssValues(FILE *fd, std::vector<std::string> ¶msInfo) const; 4106f6ba60Sopenharmony_ci std::map<std::string, std::string> SaveSumRamInfo(std::vector<std::string> paramsInfo) const; 4206f6ba60Sopenharmony_ci std::map<std::string, std::string> ProcMemNaInfo() const; 4306f6ba60Sopenharmony_ci static RAM &GetInstance() 4406f6ba60Sopenharmony_ci { 4506f6ba60Sopenharmony_ci static RAM instance; 4606f6ba60Sopenharmony_ci return instance; 4706f6ba60Sopenharmony_ci } 4806f6ba60Sopenharmony_ci std::map<std::string, std::string> ItemData() override; 4906f6ba60Sopenharmony_ci void SetPackageName(const std::string &pName); 5006f6ba60Sopenharmony_ci void ThreadGetPss() const; 5106f6ba60Sopenharmony_ci void TriggerGetPss() const; 5206f6ba60Sopenharmony_ci void SetFirstFlag(); 5306f6ba60Sopenharmony_ci void SetProcessId(const std::string &pid); 5406f6ba60Sopenharmony_ciprivate: 5506f6ba60Sopenharmony_ci RAM() {}; 5606f6ba60Sopenharmony_ci RAM(const RAM &); 5706f6ba60Sopenharmony_ci RAM &operator = (const RAM &); 5806f6ba60Sopenharmony_ci std::string packageName = ""; 5906f6ba60Sopenharmony_ci std::string processId = ""; 6006f6ba60Sopenharmony_ci}; 6106f6ba60Sopenharmony_ci} 6206f6ba60Sopenharmony_ci} 6306f6ba60Sopenharmony_ci#endif 64