Skip to content

Commit 5441026

Browse files
Treehugger Robotandroid-build-merge-worker-robot
authored andcommitted
Merge "Add kernel memory allocations to bugreport" into main am: 7e6edf5 am: ef53884
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>
2 parents 77d30b0 + ef53884 commit 5441026

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

cmds/dumpstate/Android.bp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ cc_binary {
134134
"main.cpp",
135135
],
136136
required: [
137+
"alloctop",
137138
"atrace",
138139
"bugreport_procdump",
139140
"default_screenshot",

cmds/dumpstate/dumpstate.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,15 @@ static void DumpIpAddrAndRules() {
12641264
RunCommand("IP RULES v6", {"ip", "-6", "rule", "show"});
12651265
}
12661266

1267+
static void DumpKernelMemoryAllocations() {
1268+
if (!access("/proc/allocinfo", F_OK)) {
1269+
// Print the top 100 biggest memory allocations of at least one byte.
1270+
// The output is sorted by size, descending.
1271+
RunCommand("KERNEL MEMORY ALLOCATIONS",
1272+
{"alloctop", "--once", "--sort", "s", "--min", "1", "--lines", "100"});
1273+
}
1274+
}
1275+
12671276
static Dumpstate::RunStatus RunDumpsysTextByPriority(const std::string& title, int priority,
12681277
std::chrono::milliseconds timeout,
12691278
std::chrono::milliseconds service_timeout) {
@@ -1773,6 +1782,8 @@ Dumpstate::RunStatus Dumpstate::dumpstate() {
17731782

17741783
DoKmsg();
17751784

1785+
DumpKernelMemoryAllocations();
1786+
17761787
DumpShutdownCheckpoints();
17771788

17781789
DumpIpAddrAndRules();

0 commit comments

Comments
 (0)