summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Zimuzo Ezeozue <zezeozue@google.com> 2022-10-19 18:37:21 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-10-19 18:37:21 +0000
commit4a9faef3909f82ecf794a50dad23ad05ba67500c (patch)
tree296a1d1809a1200bfd89c11e8518ebe57b59c42b
parent5054e05b317b2b0c46bd5562da86c1e723e0e416 (diff)
parentf0dd73ce6b45923a0fcf21e47ba9ddc0dec25077 (diff)
Merge "Skip tracing missing binder txn names" am: da1c78d158 am: c3355df5da am: f0dd73ce6b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2254719 Change-Id: Ic367fe949abbae007e57b34d698c1e9daf27736b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/java/android/os/Binder.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 4df013949de5..d3a6323230a5 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -1246,8 +1246,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;