Skip dumping backtraces for cached processes
This change updates dumpstate to skip dumping backtraces for cached
processes. These processes are less likely to be causing
bugreport-necessitating issues, and if they are frozen, will cause
backtrace dumps to time out anyways.
This results in a ~50% decrease (21.327s -> 10.568s) in the time taken
to run DUMP TRACES.
Test: On a local device, check with bugreportz that there are no more
timed-out backtrace dumps (i.e. that the "Dump failed, likely due
to a timeout" failure no longer occurs).
Test: Run health/bugreport/capturebugreport on an internal build and
verify that the DUMP TRACES section is much shorter.
Bug: 276451949
Change-Id: Iecb6c2168a0dccefecf3b92be24c647eaf729556
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 7537237..bb4d58b 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2196,6 +2196,16 @@
continue;
}
+ // Skip cached processes.
+ if (IsCached(pid)) {
+ // For consistency, the header and footer to this message match those
+ // dumped by debuggerd in the success case.
+ dprintf(fd, "\n---- pid %d at [unknown] ----\n", pid);
+ dprintf(fd, "Dump skipped for cached process.\n");
+ dprintf(fd, "---- end %d ----", pid);
+ continue;
+ }
+
const std::string link_name = android::base::StringPrintf("/proc/%d/exe", pid);
std::string exe;
if (!android::base::Readlink(link_name, &exe)) {