Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8601e96a authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue
Browse files

Remove unnecessary interface from Perfetto APIs

1. Removed the Builder interfaces from PerfettoTrackEventExtra
to improve performance. The interface was needed for a
NoOp impl when tracing was disabled. Instead, we just store
a boolean in the builder impl representing whether
the category is enabled or not, all the builder methods
return early if false. This saves an additional dependent load
instruction and an adrp + ldr sequence. This improves the
benchmark by a few nanos which adds up for each builder method
executed.

2. Moved the check* calls behind a DEBUG flag. This
elided the function calls entirely which were also getting inlined
and likely spilling the instruction cache. It's a debugging check
when generating protos. Besides, proto generation code is likely
to change in coming cls.

3. Added a setFlow/setTerminatingFlow call. This limits flows that
can be added to an event to at most 1 flow and terminating flow.
This is the most common case in practice anyways and we can avoid
the expensive indirection to get a flow via the Pool class.

godbolt playground to analyze the generated dex2oat code:
https://godbolt.org/z/Er9Gjvhfd

In a follow up, I'll remove addFlow/addTerminatingFlow

Test: atest PerfettoTest
Test: atest TracePerfTest
Bug: 303199244
Flag: android.os.perfetto_sdk_tracing_v2
Change-Id: I38f9853567734425ef8721dbbd93df8d83d7e257
parent 6b3d33e2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment