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; // total amount of usable RAM, unit KB 25 int32_t memFree; // unit KB 26 int32_t memAvailable; // unit KB 27 int32_t zramUsed; // unit KB 28 int32_t swapCached; // unit KB 29 int32_t cached; // unit KB 30 }; 31 32 struct ProcessMemory { 33 int32_t pid; // process id 34 std::string name; // process name 35 int32_t rss; // resident set size, unit KB 36 int32_t pss; // proportional set Size, unit KB 37 int32_t swapPss; // swap pss, unit KB 38 int32_t adj; // /proc/$pid/oom_score_adj 39 int32_t sharedDirty; //process Shared_Dirty 40 int32_t privateDirty; //process Private_Dirty 41 }; 42 43 extern "C" { 44 const int HIAI_MAX_QUERIED_USER_MEMINFO_LIMIT = 256; 45 46 typedef struct { 47 int pid; // process id 48 int size; // byte 49 } AIProcessMem; 50 }; 51 } // HiviewDFX 52 } // OHOS 53 #endif // INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_MEMORY_H 54