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

Skip to content
Commit 50adc086 authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue
Browse files

Switch from GetUTFStringChars to GetStringRegion

Replaced GetUTFStringChars/ReleaseUTFStringChars with a more efficient
direct string conversion using GetStringRegion. This eliminates
unnecessary memory allocations and copies while decoding String from
Java into JNI.

Fast path
- thread_local buffers that serve as temp string storage
while building the tracing event.
- Replaced ScopedUtfChars with string_views into these buffers,
eliminating strdup calls
Slow path
- Still uses the GetStringRegion to get the utf16 from Java but simply allocate
a new string to hold the ascii converted version instead of splicing
string_views over the (already full) TLS buffer

Fixed a potential crash where extra args that spill over the default pool
sizes are not referenced and can be GC'd before they are emitted. Appended
any pending PerfettoPointer objects to a list that's freed after emitting.

Test: atest PerfettoTest
Bug: 303199244
Flag: android.os.perfetto_sdk_tracing_v2
Change-Id: I34bc3dee062544de8194989e657ff658f76110b2
parent 74b083ad
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