Improve existing InputDispatcher traces
Previously, we traced using ATRACE_NAME inside an if condition after checking if atrace was enabled. This was so that we could avoid the addtional overhead of formatting the trace string when there's no ongoing trace. Since ATRACE_NAME is expected to be scoped trace of the call, doing it inside an if condition means the scope of the trace ends immediately once we leave the inner scope of the conditional. This essentially makes all of our scoped traces point traces. We get around this by adding a new helper macro ATRACE_NAME_IF that takes a lambda that formats the message. This way, we can avoid the formatting overhead and ensure the entire scope of the method is traced. Bug: 210460522 Test: manual: take a trace with Perfetto Change-Id: Ibee1e7dc5021296bdb5871dec59d8d4978fcf0c9
Loading
Please register or sign in to comment