summaryrefslogtreecommitdiff
path: root/api/coverage/tools
diff options
context:
space:
mode:
author Zimuzo Ezeozue <zezeozue@google.com> 2025-01-07 19:52:56 +0000
committer Zimuzo Ezeozue <zezeozue@google.com> 2025-01-16 13:26:13 +0000
commitad0b0ed2bbb578adc64d17d89dcd4c9758b88c73 (patch)
treece301372fba80e734fdf985e551a265a1035bc9b /api/coverage/tools
parent7a78b07aab94045791fcc76a0dda540b1c06d83f (diff)
Improve PerfettoTrace API
The old API was of the form: PerfettoTrace.instant(category, name, extra). This was not ideal for a few reasons: 1. Initializing the thread local extra was decoupled from the call to emit an event and could be error prone if people initialize an extra away from the point where it's emitted. 2. This call would ideally be wrapped around a check for isTraceEnabled to avoid paying the cost of initializing the method parameters. There was an alternative API that accepted a lambda, but that incurs an object allocation on each call which is bad for the GC. The new API is of the form: PerfettoTrace.instant(category, name) .addArg(String val, Object... args) .emit(). This addresses both problems mentioned above. When tracing is disabled, each intermediat call returns a NoOpBuilder that just returns 'this'. Also fixed use-after-free with JNI string extraction. Bug: 303199244 Flag: android.os.perfetto_sdk_tracing_v2 Test: atest PerfettoTraceTest Change-Id: I6e732c58275d6ee00bc7c492a804ac32e5bcb47c
Diffstat (limited to 'api/coverage/tools')
0 files changed, 0 insertions, 0 deletions