diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-07-25 03:58:45 +0000 |
---|---|---|
committer | Android Partner Code Review <android-gerrit-partner@google.com> | 2020-07-25 03:58:45 +0000 |
commit | 530e32152c32a8fdafd54a3d13f2e583fd8ae64c (patch) | |
tree | 7504d83823e5113f7c2d4abeab9a7cb52a79c70e | |
parent | 767f1242efa5eb77d3dd9505a8511d109be2c027 (diff) | |
parent | 97168c1b197f435763f8b01998cdea4d88a0a51e (diff) | |
download | device_google_trout-530e32152c32a8fdafd54a3d13f2e583fd8ae64c.tar.gz device_google_trout-530e32152c32a8fdafd54a3d13f2e583fd8ae64c.tar.bz2 device_google_trout-530e32152c32a8fdafd54a3d13f2e583fd8ae64c.zip |
Merge "Set dumpstate pool to 2 threads" into rvc-dev
-rw-r--r-- | hal/dumpstate/1.1/DumpstateDevice.cpp | 20 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateDevice.h | 5 | ||||
-rw-r--r-- | hal/dumpstate/1.1/service.cpp | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/hal/dumpstate/1.1/DumpstateDevice.cpp b/hal/dumpstate/1.1/DumpstateDevice.cpp index 0f7d545..5e419fe 100644 --- a/hal/dumpstate/1.1/DumpstateDevice.cpp +++ b/hal/dumpstate/1.1/DumpstateDevice.cpp @@ -247,6 +247,26 @@ Return<bool> DumpstateDevice::getVerboseLoggingEnabled() { return android::base::GetBoolProperty(VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY, false); } +Return<void> DumpstateDevice::debug(const hidl_handle& h, const hidl_vec<hidl_string>& options) { + if (h.getNativeHandle() == nullptr || h->numFds == 0) { + LOG(ERROR) << "Invalid FD passed to debug() function"; + return Void(); + } + + const int fd = h->data[0]; + auto pf = [fd](std::string s) -> void { dprintf(fd, "%s\n", s.c_str()); }; + debugDumpServices(pf); + + return Void(); +} + +void DumpstateDevice::debugDumpServices(std::function<void(std::string)> f) { + f("Available services for Dumpstate:"); + for (const auto& svc : getAvailableServices()) { + f(" " + svc); + } +} + sp<DumpstateDevice> makeVirtualizationDumpstateDevice(const std::string& addr) { return new DumpstateDevice(addr); } diff --git a/hal/dumpstate/1.1/DumpstateDevice.h b/hal/dumpstate/1.1/DumpstateDevice.h index 76dd931..0b40a11 100644 --- a/hal/dumpstate/1.1/DumpstateDevice.h +++ b/hal/dumpstate/1.1/DumpstateDevice.h @@ -18,6 +18,7 @@ #include <android/hardware/dumpstate/1.1/IDumpstateDevice.h> #include <automotive/filesystem> +#include <functional> #include <grpc++/grpc++.h> @@ -43,12 +44,16 @@ class DumpstateDevice : public IDumpstateDevice { bool isHealthy(); + Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options); + private: bool dumpRemoteLogs(::grpc::ClientReaderInterface<dumpstate_proto::DumpstateBuffer>* reader, const fs::path& dumpPath); bool dumpHelperSystem(int textFd, int binFd); + void debugDumpServices(std::function<void(std::string)> f); + std::vector<std::string> getAvailableServices(); std::string mServiceAddr; diff --git a/hal/dumpstate/1.1/service.cpp b/hal/dumpstate/1.1/service.cpp index 09ead42..5c0f08a 100644 --- a/hal/dumpstate/1.1/service.cpp +++ b/hal/dumpstate/1.1/service.cpp @@ -60,7 +60,7 @@ int main() { auto dumpstate = makeVirtualizationDumpstateDevice(si->str()); // This method MUST be called before interacting with any HIDL interfaces. - configureRpcThreadpool(1, true); + configureRpcThreadpool(2, true); if (dumpstate->registerAsService() != OK) { ALOGE("Could not register service."); return 1; |