Skip to content
Commit 98d92aa5 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Support a ring buffer or a queue to store window manager traces

Currently the WM uses a BlockingQueue with limited capacity to store
the traces and a separate thread to continuously write the buffer
elements to disk. This implementation allows the WM trace to use its
current logging behavior or to use a ring buffer instead.

The ring buffer:
- Stores the most recent traces and discard the oldest ones when it
reaches maximum capacity.
- Write to disk only when the trace logging is stopped or during a
bugreport, instead of having a thread to continuously write to disk.

The ring buffer can be selected (or disabled)  using the command:
- adb shell cmd window tracing continuous (true/false)
Any value other than "true" (case insensitive) is considered false

After selecting ring buffer, start and stop WM trace
monitoring with 'adb shell cmd window tracing (start/stop)'

Current capacity is fixed to 512KB. Future implementations will make
this value configurable.

Test: Flash a device. Enable continuous mode and window manager
tracing. Use the device. Stop the trace and pull the logged trace.
Open the trace in Winscope and check if the last X KB of data are
there. Unit tests: atest WmTests:WindowTraceBufferTest

Change-Id: Id4108b0231ab7af504240ea35c8a030fecf8b8a9
parent ffa0d6c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment