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 
16 #ifndef INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_MEMORY_H
17 #define INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_MEMORY_H
18 #include <cinttypes>
19 #include <string>
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 struct SysMemory {
24     int32_t memTotal = 0;        // total amount of usable RAM, unit KB
25     int32_t memFree = 0;         // unit KB
26     int32_t memAvailable = 0;    // unit KB
27     int32_t zramUsed = 0;        // unit KB
28     int32_t swapCached = 0;      // unit KB
29     int32_t cached = 0;          // unit KB
30 };
31 
32 struct ProcessMemory {
33     int32_t pid = 0;             // process id
34     std::string name;            // process name
35     int32_t rss = 0;             // resident set size, unit KB
36     int32_t pss = 0;             // proportional set Size, unit KB
37     int32_t swapPss = 0;         // swap pss, unit KB
38     int32_t adj = 0;             // /proc/$pid/oom_score_adj
39     int32_t sharedDirty = 0;     // process Shared_Dirty
40     int32_t privateDirty = 0;    // process Private_Dirty
41     int32_t sharedClean = 0;     // process Shared_Clean
42     int32_t privateClean = 0;    // process Private_Clean
43     int32_t procState = 0;       // process State
44 };
45 
46 struct MemoryLimit {
47     uint64_t rssLimit = 0;
48     uint64_t vssLimit = 0;
49 };
50 
51 enum class GraphicType {
52     TOATL,
53     GL,
54     GRAPH,
55 };
56 
57 extern "C" {
58 const int HIAI_MAX_QUERIED_USER_MEMINFO_LIMIT = 256;
59 
60 using AIProcessMem = struct AIProcessMem {
61     int pid = 0;                 // process id
62     int size = 0;                // byte
63 };
64 };
65 } // HiviewDFX
66 } // OHOS
67 #endif // INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_MEMORY_H
68