diff options
author | Steven Moreland <smoreland@google.com> | 2022-02-24 22:06:40 +0000 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2022-02-24 22:07:44 +0000 |
commit | 281abad3fa097267ff63c9936f78f664ad61f322 (patch) | |
tree | b7cac2582b732a2ec23addde92874c41d48ab143 | |
parent | 0f899ce8dcff7f47dbbe20a9fae27534f1fc19ef (diff) | |
download | native-281abad3fa097267ff63c9936f78f664ad61f322.tar.gz |
libbinder: binder thread names ++
As requested by perf team, show domain information first.
So, the thread name might look like:
binder:3_4
vndbinder:7_8
Fixes: 220391109
Test: boot, ps -AT
Change-Id: I70d5d15db01887c01e50cf0b6f656d71ff75d045
-rw-r--r-- | libs/binder/ProcessState.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 1821729cfa..baa817c6b9 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -19,6 +19,7 @@ #include <binder/ProcessState.h> #include <android-base/result.h> +#include <android-base/strings.h> #include <binder/BpBinder.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> @@ -367,8 +368,13 @@ void ProcessState::expungeHandle(int32_t handle, IBinder* binder) String8 ProcessState::makeBinderThreadName() { int32_t s = android_atomic_add(1, &mThreadPoolSeq); pid_t pid = getpid(); + + std::string_view driverName = mDriverName.c_str(); + android::base::ConsumePrefix(&driverName, "/dev/"); + String8 name; - name.appendFormat("%d_%X:%s", pid, s, mDriverName.c_str()); + name.appendFormat("%.*s:%d_%X", static_cast<int>(driverName.length()), driverName.data(), pid, + s); return name; } |