Add thread usage output to lshal.
This output shows how many threads are in use at a give time.
Test: lshal, manual
Bug: 35099601
Change-Id: I3a22bb131b828cdd77e73e7810229d9c68a496d3
diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h
index f367d7f..a75db04 100644
--- a/cmds/lshal/ListCommand.h
+++ b/cmds/lshal/ListCommand.h
@@ -48,18 +48,26 @@
Status fetchPassthrough(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
Status fetchBinderized(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
Status fetchAllLibraries(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
- bool getReferencedPids(
- pid_t serverPid, std::map<uint64_t, Pids> *objects) const;
+
+ struct PidInfo {
+ std::map<uint64_t, Pids> refPids; // pids that are referenced
+ uint32_t threadUsage; // number of threads in use
+ uint32_t threadCount; // number of threads total
+ };
+ bool getPidInfo(pid_t serverPid, PidInfo *info) const;
+
void dumpTable();
void dumpVintf() const;
void printLine(
const std::string &interfaceName,
const std::string &transport,
const std::string &arch,
+ const std::string &threadUsage,
const std::string &server,
const std::string &serverCmdline,
- const std::string &address, const std::string &clients,
- const std::string &clientCmdlines) const ;
+ const std::string &address,
+ const std::string &clients,
+ const std::string &clientCmdlines) const;
// Return /proc/{pid}/cmdline if it exists, else empty string.
const std::string &getCmdline(pid_t pid);
// Call getCmdline on all pid in pids. If it returns empty string, the process might