Skip to content

Commit ef53884

Browse files
Treehugger Robotandroid-build-merge-worker-robot
authored andcommitted
Merge "Add kernel memory allocations to bugreport" into main am: 7e6edf5
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3406679 Change-Id: Ie44beb3d8ab34f9c4ed14a9927b8889f1c7b5afe Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2 parents 10b9377 + 7e6edf5 commit ef53884

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
@@ -128,6 +128,7 @@ cc_binary {
128128
"main.cpp",
129129
],
130130
required: [
131+
"alloctop",
131132
"atrace",
132133
"bugreport_procdump",
133134
"dmabuf_dump",

cmds/dumpstate/dumpstate.cpp

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

1260+
static void DumpKernelMemoryAllocations() {
1261+
if (!access("/proc/allocinfo", F_OK)) {
1262+
// Print the top 100 biggest memory allocations of at least one byte.
1263+
// The output is sorted by size, descending.
1264+
RunCommand("KERNEL MEMORY ALLOCATIONS",
1265+
{"alloctop", "--once", "--sort", "s", "--min", "1", "--lines", "100"});
1266+
}
1267+
}
1268+
12601269
static Dumpstate::RunStatus RunDumpsysTextByPriority(const std::string& title, int priority,
12611270
std::chrono::milliseconds timeout,
12621271
std::chrono::milliseconds service_timeout) {
@@ -1766,6 +1775,8 @@ Dumpstate::RunStatus Dumpstate::dumpstate() {
17661775

17671776
DoKmsg();
17681777

1778+
DumpKernelMemoryAllocations();
1779+
17691780
DumpShutdownCheckpoints();
17701781

17711782
DumpIpAddrAndRules();

0 commit comments

Comments
 (0)