dumpsys: add --thread option
This displays the thread usage of services in the format
"<threadsUsed>/<threadCount>". This has been useful in lshal to find
deadlocks in binder threads.
Test: atest dumpsys_test
Test: run 'dumpsys --thread' on cuttlefish and verify thread usage
Test: run 'dumpsys --thread SurfaceFlinger' and verify thread usage
Bug: 140639610
Change-Id: I0cd3f86ca47ec911b276d8e8859ef54743ee34cf
diff --git a/cmds/dumpsys/dumpsys.h b/cmds/dumpsys/dumpsys.h
index 929c55c..349947c 100644
--- a/cmds/dumpsys/dumpsys.h
+++ b/cmds/dumpsys/dumpsys.h
@@ -52,13 +52,14 @@
static void setServiceArgs(Vector<String16>& args, bool asProto, int priorityFlags);
enum class Type {
- DUMP, // dump using `dump` function
- PID, // dump pid of server only
+ DUMP, // dump using `dump` function
+ PID, // dump pid of server only
+ THREAD, // dump thread usage of server only
};
/**
* Starts a thread to connect to a service and get its dump output. The thread redirects
- * the output to a pipe. Thread must be stopped by a subsequent callto {@code
+ * the output to a pipe. Thread must be stopped by a subsequent call to {@code
* stopDumpThread}.
* @param serviceName
* @param args list of arguments to pass to service dump method.