| /* |
| * Copyright (C) 2024 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #pragma once |
| |
| namespace android { |
| namespace meminfo { |
| |
| struct AndroidHeapStats { |
| int pss; |
| int swappablePss; |
| int rss; |
| int privateDirty; |
| int sharedDirty; |
| int privateClean; |
| int sharedClean; |
| int swappedOut; |
| int swappedOutPss; |
| }; |
| |
| // LINT.IfChange |
| enum { |
| HEAP_UNKNOWN, |
| HEAP_DALVIK, |
| HEAP_NATIVE, |
| |
| HEAP_DALVIK_OTHER, |
| HEAP_STACK, |
| HEAP_CURSOR, |
| HEAP_ASHMEM, |
| HEAP_GL_DEV, |
| HEAP_UNKNOWN_DEV, |
| HEAP_SO, |
| HEAP_JAR, |
| HEAP_APK, |
| HEAP_TTF, |
| HEAP_DEX, |
| HEAP_OAT, |
| HEAP_ART, |
| HEAP_UNKNOWN_MAP, |
| HEAP_GRAPHICS, |
| HEAP_GL, |
| HEAP_OTHER_MEMTRACK, |
| |
| // Dalvik extra sections (heap). |
| HEAP_DALVIK_NORMAL, |
| HEAP_DALVIK_LARGE, |
| HEAP_DALVIK_ZYGOTE, |
| HEAP_DALVIK_NON_MOVING, |
| |
| // Dalvik other extra sections. |
| HEAP_DALVIK_OTHER_LINEARALLOC, |
| HEAP_DALVIK_OTHER_ACCOUNTING, |
| HEAP_DALVIK_OTHER_ZYGOTE_CODE_CACHE, |
| HEAP_DALVIK_OTHER_APP_CODE_CACHE, |
| HEAP_DALVIK_OTHER_COMPILER_METADATA, |
| HEAP_DALVIK_OTHER_INDIRECT_REFERENCE_TABLE, |
| |
| // Boot vdex / app dex / app vdex |
| HEAP_DEX_BOOT_VDEX, |
| HEAP_DEX_APP_DEX, |
| HEAP_DEX_APP_VDEX, |
| |
| // App art, boot art. |
| HEAP_ART_APP, |
| HEAP_ART_BOOT, |
| |
| _NUM_HEAP, |
| _NUM_EXCLUSIVE_HEAP = HEAP_OTHER_MEMTRACK + 1, |
| _NUM_CORE_HEAP = HEAP_NATIVE + 1 |
| |
| }; |
| // LINT.ThenChange(/frameworks/base/core/java/android/os/Debug.java) |
| |
| bool ExtractAndroidHeapStats(int pid, AndroidHeapStats* stats, bool* foundSwapPss); |
| |
| bool ExtractAndroidHeapStatsFromFile(const std::string& path, AndroidHeapStats* stats, |
| bool* foundSwapPss); |
| } // namespace meminfo |
| } // namespace android |