diff options
author | 2022-10-19 17:45:34 +0000 | |
---|---|---|
committer | 2022-10-19 17:45:34 +0000 | |
commit | c3355df5da37cd0e78bce83920c579f2cb50d0b4 (patch) | |
tree | bddd7e7d5cb9f167728042fe8285ae6bbe77b292 | |
parent | 7a54741e615f43491a249d74ec1ffe0ef24129bf (diff) | |
parent | da1c78d15811d9b31a12dc7fe063e1a7ec65fee7 (diff) |
Merge "Skip tracing missing binder txn names" am: da1c78d158
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2254719
Change-Id: I56ebf652bb9b73772df918aebb268caa7bf3f20a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | core/java/android/os/Binder.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index 9d90e174b470..80b34a107a25 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -1241,8 +1241,21 @@ public class Binder implements IBinder { // If the call was {@link IBinder#FLAG_ONEWAY} then these exceptions // disappear into the ether. final boolean tagEnabled = Trace.isTagEnabled(Trace.TRACE_TAG_AIDL); + final boolean hasFullyQualifiedName = getMaxTransactionId() > 0; final String transactionTraceName; - if (tagEnabled) { + + if (tagEnabled && hasFullyQualifiedName) { + // If tracing enabled and we have a fully qualified name, fetch the name + transactionTraceName = getTransactionTraceName(code); + } else if (tagEnabled && isStackTrackingEnabled()) { + // If tracing is enabled and we *don't* have a fully qualified name, fetch the + // 'best effort' name only for stack tracking. This works around noticeable perf impact + // on low latency binder calls (<100us). The tracing call itself is between (1-10us) and + // the perf impact can be quite noticeable while benchmarking such binder calls. + // The primary culprits are ContentProviders and Cursors which convenienty don't + // autogenerate their AIDL and hence will not have a fully qualified name. + // + // TODO(b/253426478): Relax this constraint after a more robust fix transactionTraceName = getTransactionTraceName(code); } else { transactionTraceName = null; |