• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef SMAPS_MEMORY_INFO_H
16 #define SMAPS_MEMORY_INFO_H
17 #include <map>
18 #include <memory>
19 #include <string>
20 #include <vector>
21 #include "common.h"
22 #include "executor/memory/parse/parse_smaps_info.h"
23 
24 namespace OHOS {
25 namespace HiviewDFX {
26 class SmapsMemoryInfo {
27 public:
28     SmapsMemoryInfo();
29     ~SmapsMemoryInfo();
30 
31     using StringMatrix = std::shared_ptr<std::vector<std::vector<std::string>>>;
32     bool ShowMemorySmapsByPid(const int &pid, StringMatrix result, bool isShowSmapsInfo);
33 
34 private:
35     void InsertSmapsTitle(StringMatrix result, bool isShowSmapsInfo);
36     void SetValueForRet(const std::string& value, const int &width, std::vector<std::string>& tempResult);
37     void SetOneRowMemInfo(const MemoryData &memoryData, bool isShowSmapsInfo, bool isSummary, StringMatrix result);
38     void UpdateShowAddressMemInfoResult(const std::vector<MemoryData>& showAddressMemInfoVec, StringMatrix result);
39     void UpdateCountSameNameMemResult(std::map<std::string, MemoryData>& countSameNameMemMap, StringMatrix result);
40 };
41 } // namespace HiviewDFX
42 } // namespace OHOS
43 #endif
44