1 /*
2 * Copyright (C) 2021-2022 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 MEMINFO_DATA_H
16 #define MEMINFO_DATA_H
17 #include <memory>
18 #include <sys/types.h>
19 #include <string>
20 namespace OHOS {
21 namespace HiviewDFX {
22 class MemInfoData {
23 public:
24     MemInfoData();
25     ~MemInfoData();
26 
27     struct MemInfo {
28         uint64_t rss = 0;
29         uint64_t pss = 0;
30         uint64_t sharedClean = 0;
31         uint64_t sharedDirty = 0;
32         uint64_t privateClean = 0;
33         uint64_t privateDirty = 0;
34         uint64_t swap = 0;
35         uint64_t swapPss = 0;
36         uint64_t heapSize = 0;
37         uint64_t heapAlloc = 0;
38         uint64_t heapFree = 0;
39     };
40 
41     struct MemSmapsInfo {
42         uint64_t rss = 0;
43         uint64_t pss = 0;
44         uint64_t sharedClean = 0;
45         uint64_t sharedDirty = 0;
46         uint64_t privateClean = 0;
47         uint64_t privateDirty = 0;
48         uint64_t swap = 0;
49         uint64_t swapPss = 0;
50         std::string name;
51         std::string start;
52         std::string end;
53         std::string perm;
54         uint64_t size = 0;
55         uint64_t counts = 0;
56     };
57 
58     struct MemUsage {
59         uint64_t vss = 0;
60         uint64_t rss = 0;
61         uint64_t uss = 0;
62         uint64_t pss = 0;
63         uint64_t swapPss = 0;
64         uint64_t gl = 0;
65         uint64_t graph = 0;
66         uint64_t dma = 0;
67         uint64_t purgSum = 0;
68         uint64_t purgPin = 0;
69         int pid = -1;
70         std::string name;
71         std::string adjLabel;
72     };
73 
74     struct DmaInfo {
75         uint64_t size = 0;
76         uint64_t ino = 0;
77         uint32_t pid = 0;
78         std::string name;
79     };
80 
81     struct GraphicsMemory {
82         uint64_t gl = 0;
83         uint64_t graph = 0;
84     };
85 
86     struct HiaiUserAllocatedMemInfo {
87         int pid = -1;
88         int size = 0;
89     };
90 
91 private:
92 };
93 } // namespace HiviewDFX
94 } // namespace OHOS
95 
96 #endif
97