diff options
| author | 2020-02-25 12:27:14 -0800 | |
|---|---|---|
| committer | 2020-02-25 21:40:13 +0000 | |
| commit | aca85366df40ebb5ed5070fba1a21c56c43b41c1 (patch) | |
| tree | 1844b39192cf5c0aa953373c44ab99ba0e9e86d5 | |
| parent | 1c7bc86a9b1bdf16b240a96d083102127f036325 (diff) | |
lshal: read binder stats from binderfs
If binderfs is mounted, lshal should read binder stats
from /dev/binderfs/binder_logs instead of debugfs.
Bug: 150233443
Test: atest lshal_test, adb shell lshal
Change-Id: Id585cdcd71c0ab4346045a099c2e3d0ddffcecc0
Merged-In: Id585cdcd71c0ab4346045a099c2e3d0ddffcecc0
| -rw-r--r-- | cmds/lshal/ListCommand.cpp | 7 | ||||
| -rw-r--r-- | cmds/lshal/ListCommand.h | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp index a7ccf64c50..f426dbbc4f 100644 --- a/cmds/lshal/ListCommand.cpp +++ b/cmds/lshal/ListCommand.cpp @@ -206,9 +206,12 @@ VintfInfo ListCommand::getVintfInfo(const std::string& fqInstanceName, static bool scanBinderContext(pid_t pid, const std::string &contextName, std::function<void(const std::string&)> eachLine) { - std::ifstream ifs("/d/binder/proc/" + std::to_string(pid)); + std::ifstream ifs("/dev/binderfs/binder_logs/proc/" + std::to_string(pid)); if (!ifs.is_open()) { - return false; + ifs.open("/d/binder/proc/" + std::to_string(pid)); + if (!ifs.is_open()) { + return false; + } } static const std::regex kContextLine("^context (\\w+)$"); diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h index b3ed23d1fc..acc0dcfc2e 100644 --- a/cmds/lshal/ListCommand.h +++ b/cmds/lshal/ListCommand.h @@ -104,7 +104,8 @@ protected: Status fetchBinderizedEntry(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager, TableEntry *entry); - // Get relevant information for a PID by parsing files under /d/binder. + // Get relevant information for a PID by parsing files under + // /dev/binderfs/binder_logs or /d/binder. // It is a virtual member function so that it can be mocked. virtual bool getPidInfo(pid_t serverPid, PidInfo *info) const; // Retrieve from mCachedPidInfos and call getPidInfo if necessary. |