From a082fa8a6bd4303d5a5921133746f9e2856ab0d4 Mon Sep 17 00:00:00 2001 From: Philip Cuadra Date: Fri, 8 Apr 2016 10:29:14 -0700 Subject: [PATCH] Binder: add pid to thread name for binder threads. Including the pid in the binder thread name improves attribution of binder time in systraces. Change-Id: I40461b6f98c51c6e5f0acc1c24d443d0e7109b69 --- libs/binder/ProcessState.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 33fe26cfa9..b221e51811 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -40,12 +40,12 @@ #include #include #include +#include #define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2)) #define DEFAULT_MAX_BINDER_THREADS 15 - -// --------------------------------------------------------------------------- +// ------------------------------------------------------------------------- namespace android { @@ -278,8 +278,9 @@ void ProcessState::expungeHandle(int32_t handle, IBinder* binder) String8 ProcessState::makeBinderThreadName() { int32_t s = android_atomic_add(1, &mThreadPoolSeq); + pid_t pid = getpid(); String8 name; - name.appendFormat("Binder_%X", s); + name.appendFormat("Binder:%d_%X", pid, s); return name; } -- 2.11.0