summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-12-30 11:23:08 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-12-30 11:23:08 -0800
commit544102644e345d68af5877116d987e7c877756cd (patch)
tree68adacf27f849e9f9efa931ca47d50f36246ee61
parent77d30b04588633acccaa9181921ada1bfaf922f6 (diff)
parentef53884492e1ae159b1ff83ea8576c04d2e6e9f9 (diff)
Merge "Add kernel memory allocations to bugreport" into main am: 7e6edf5c58 am: ef53884492
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3406679 Change-Id: I21683dfcebfb88be4a48734cbdff2073b69423f1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--cmds/dumpstate/Android.bp1
-rw-r--r--cmds/dumpstate/dumpstate.cpp11
2 files changed, 12 insertions, 0 deletions
diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp
index 372008e63b..94590876b7 100644
--- a/cmds/dumpstate/Android.bp
+++ b/cmds/dumpstate/Android.bp
@@ -134,6 +134,7 @@ cc_binary {
"main.cpp",
],
required: [
+ "alloctop",
"atrace",
"bugreport_procdump",
"default_screenshot",
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 4758607122..fcc6108f5f 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1264,6 +1264,15 @@ static void DumpIpAddrAndRules() {
RunCommand("IP RULES v6", {"ip", "-6", "rule", "show"});
}
+static void DumpKernelMemoryAllocations() {
+ if (!access("/proc/allocinfo", F_OK)) {
+ // Print the top 100 biggest memory allocations of at least one byte.
+ // The output is sorted by size, descending.
+ RunCommand("KERNEL MEMORY ALLOCATIONS",
+ {"alloctop", "--once", "--sort", "s", "--min", "1", "--lines", "100"});
+ }
+}
+
static Dumpstate::RunStatus RunDumpsysTextByPriority(const std::string& title, int priority,
std::chrono::milliseconds timeout,
std::chrono::milliseconds service_timeout) {
@@ -1773,6 +1782,8 @@ Dumpstate::RunStatus Dumpstate::dumpstate() {
DoKmsg();
+ DumpKernelMemoryAllocations();
+
DumpShutdownCheckpoints();
DumpIpAddrAndRules();