Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tracking on choreographer frame ends #68

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Improve tracking on choreographer frame ends #68

merged 1 commit into from
Sep 10, 2024

Conversation

pyricau
Copy link
Member

@pyricau pyricau commented Sep 6, 2024

Behavior changes

Whenever possible (i.e. any API != 28), we'll now detect the end of a frame by spying on main thread messages and running code right when the main thread message is done running and before a new main thread message starts running, by leveraging Looper.getMainLooper().setMessageLogging { }. We're also detecting whether we're in a frame or not by looking at the name of the runnable, rather than by creating a stacktrace.

Non backward compatible API changes

  • Renamed MainThreadMessageSpy.startTracing() and MainThreadMessageSpy.stopTracing() to MainThreadMessageSpy.addTracer() and MainThreadMessageSpy.removeTracer().

New APIs

  • MainThreadMessageSpy.startSpyingMainThreadDispatching() and MainThreadMessageSpy.stopSpyingMainThreadDispatching(), MainThreadMessageSpy.currentMessageAsString, MainThreadMessageSpy.enabled and MainThreadMessageSpy.onCurrentMessageFinished()
  • MainThreadMessageScopedLazy (prop by mainThreadMessageScopedLazy {}) property for main thread scoped lazy properties that get cleared at the end of each main thread message.
  • Choreographers.postOnFrameRendered(), Choreographers.postOnWindowFrameRendered() and Choreographers.isInChoreographerFrame
  • InputEventTrigger.rendered, InputEventTrigger.renderedUptime and InputEventTrigger.onInputEventFrameRendered

@pyricau pyricau force-pushed the py/choreo branch 6 times, most recently from c99cbaa to 0bba709 Compare September 9, 2024 18:46
@pyricau pyricau changed the title TODO work on commit msg Improve tracking on choreographer frame ends Sep 9, 2024
@pyricau pyricau force-pushed the py/choreo branch 5 times, most recently from 3dedc91 to 1ecb5be Compare September 10, 2024 16:31
## Behavior changes

Whenever possible (i.e. any API != 28), we'll now detect the end of a frame by spying on main thread messages and running code right when the main thread message is done running and before a new main thread message starts running, by leveraging `Looper.getMainLooper().setMessageLogging { }`. We're also detecting whether we're in a frame or not by looking at the name of the runnable, rather than by creating a stacktrace.

## Non backward compatible API changes

- Renamed `MainThreadMessageSpy.startTracing()` and `MainThreadMessageSpy.stopTracing()` to `MainThreadMessageSpy.addTracer()` and `MainThreadMessageSpy.removeTracer()`.

## New APIs

- `MainThreadMessageSpy.startSpyingMainThreadDispatching()` and `MainThreadMessageSpy.stopSpyingMainThreadDispatching()`, `MainThreadMessageSpy.currentMessageAsString`, `MainThreadMessageSpy.enabled` and `MainThreadMessageSpy.onCurrentMessageFinished()`
- `MainThreadMessageScopedLazy` (`prop by mainThreadMessageScopedLazy {}`) property for main thread scoped lazy properties that get cleared at the end of each main thread message.
- `Choreographers.postOnFrameRendered()`, `Choreographers.postOnWindowFrameRendered()` and `Choreographers.isInChoreographerFrame`
- `InputEventTrigger.rendered`, `InputEventTrigger.renderedUptime` and `InputEventTrigger.onInputEventFrameRendered`
@pyricau pyricau merged commit 7e0f1b6 into main Sep 10, 2024
13 checks passed
@pyricau pyricau deleted the py/choreo branch September 10, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant