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/TableEntry.h b/cmds/lshal/TableEntry.h
index 9ae8f78..e04c3ca 100644
--- a/cmds/lshal/TableEntry.h
+++ b/cmds/lshal/TableEntry.h
@@ -47,6 +47,8 @@
std::string interfaceName;
std::string transport;
int32_t serverPid;
+ uint32_t threadUsage;
+ uint32_t threadCount;
std::string serverCmdline;
uint64_t serverObjectAddress;
Pids clientPids;
@@ -59,6 +61,14 @@
static bool sortByServerPid(const TableEntry &a, const TableEntry &b) {
return a.serverPid < b.serverPid;
};
+
+ std::string getThreadUsage() const {
+ if (threadCount == 0) {
+ return "N/A";
+ }
+
+ return std::to_string(threadUsage) + "/" + std::to_string(threadCount);
+ }
};
struct Table {
@@ -80,7 +90,8 @@
ENABLE_SERVER_PID = 1 << 2,
ENABLE_SERVER_ADDR = 1 << 3,
ENABLE_CLIENT_PIDS = 1 << 4,
- ENABLE_ARCH = 1 << 5
+ ENABLE_ARCH = 1 << 5,
+ ENABLE_THREADS = 1 << 6,
};
using TableEntrySelect = unsigned int;