1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 namespace android { 20 namespace meminfo { 21 22 struct AndroidHeapStats { 23 int pss; 24 int swappablePss; 25 int rss; 26 int privateDirty; 27 int sharedDirty; 28 int privateClean; 29 int sharedClean; 30 int swappedOut; 31 int swappedOutPss; 32 }; 33 34 // LINT.IfChange 35 enum { 36 HEAP_UNKNOWN, 37 HEAP_DALVIK, 38 HEAP_NATIVE, 39 40 HEAP_DALVIK_OTHER, 41 HEAP_STACK, 42 HEAP_CURSOR, 43 HEAP_ASHMEM, 44 HEAP_GL_DEV, 45 HEAP_UNKNOWN_DEV, 46 HEAP_SO, 47 HEAP_JAR, 48 HEAP_APK, 49 HEAP_TTF, 50 HEAP_DEX, 51 HEAP_OAT, 52 HEAP_ART, 53 HEAP_UNKNOWN_MAP, 54 HEAP_GRAPHICS, 55 HEAP_GL, 56 HEAP_OTHER_MEMTRACK, 57 58 // Dalvik extra sections (heap). 59 HEAP_DALVIK_NORMAL, 60 HEAP_DALVIK_LARGE, 61 HEAP_DALVIK_ZYGOTE, 62 HEAP_DALVIK_NON_MOVING, 63 64 // Dalvik other extra sections. 65 HEAP_DALVIK_OTHER_LINEARALLOC, 66 HEAP_DALVIK_OTHER_ACCOUNTING, 67 HEAP_DALVIK_OTHER_ZYGOTE_CODE_CACHE, 68 HEAP_DALVIK_OTHER_APP_CODE_CACHE, 69 HEAP_DALVIK_OTHER_COMPILER_METADATA, 70 HEAP_DALVIK_OTHER_INDIRECT_REFERENCE_TABLE, 71 72 // Boot vdex / app dex / app vdex 73 HEAP_DEX_BOOT_VDEX, 74 HEAP_DEX_APP_DEX, 75 HEAP_DEX_APP_VDEX, 76 77 // App art, boot art. 78 HEAP_ART_APP, 79 HEAP_ART_BOOT, 80 81 _NUM_HEAP, 82 _NUM_EXCLUSIVE_HEAP = HEAP_OTHER_MEMTRACK + 1, 83 _NUM_CORE_HEAP = HEAP_NATIVE + 1 84 85 }; 86 // LINT.ThenChange(/frameworks/base/core/java/android/os/Debug.java) 87 88 bool ExtractAndroidHeapStats(int pid, AndroidHeapStats* stats, bool* foundSwapPss); 89 90 bool ExtractAndroidHeapStatsFromFile(const std::string& path, AndroidHeapStats* stats, 91 bool* foundSwapPss); 92 } // namespace meminfo 93 } // namespace android 94