From 1da80c5047afb7776220e456ebd539338d62a09b Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Sat, 9 Jan 2021 22:10:11 -0800 Subject: dumpstate: print DMA-BUF sysfs stats in bugreport Dump DMA-BUF per-buffer/per-exporter/per-device stats in bugreport. These statistics will be helpful to analyze memory-related issues like Low Memory Kills and ANR events. Measured over 5 cycles, the addition of the statistics appear to approximately increase the size of bugreport.zip by 26KB. Bug: 167709539 Test: adb shell am bug-report Change-Id: I2aceef79c4ec97ad400cb250c0075004fe50cdc6 --- cmds/dumpstate/Android.bp | 1 + cmds/dumpstate/dumpstate.cpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp index 80d14ac3c4..34e9a85af3 100644 --- a/cmds/dumpstate/Android.bp +++ b/cmds/dumpstate/Android.bp @@ -112,6 +112,7 @@ cc_binary { ], required: [ "atrace", + "dmabuf_dump", "ip", "iptables", "librank", diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 9c5b8833d7..7d41a2eac4 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -1823,10 +1823,8 @@ Dumpstate::RunStatus Dumpstate::DumpstateDefaultAfterCritical() { RunCommand("IOTOP", {"iotop", "-n", "1", "-m", "100"}); // Gather shared memory buffer info if the product implements it - struct stat st; - if (!stat("/product/bin/dmabuf_dump", &st)) { - RunCommand("Dmabuf dump", {"/product/bin/dmabuf_dump"}); - } + RunCommand("Dmabuf dump", {"dmabuf_dump"}); + RunCommand("Dmabuf per-buffer/per-exporter/per-device stats", {"dmabuf_dump", "-b"}); DumpFile("PSI cpu", "/proc/pressure/cpu"); DumpFile("PSI memory", "/proc/pressure/memory"); -- cgit v1.2.3-59-g8ed1b