You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
On Android, consider tracing significant operations with Android Trace APIs #18178
From the Android platform side, it's often very useful to see what an app is doing from within Systrace, which shows tracing data from all the processes and services on the device: https://developer.android.com/studio/command-line/systrace
I know Flutter has its own tracing, but it's nice for platform/system-health folks to broadly know what's going on from just Systrace, especially in the context of graphics pipeline.
The tracing infrastructure on Android is optimized to be near zero cost when tracing isn't enabled, so it's just a single easily predicted branch in practice. It's somewhat expensive when tracing is on though (roughly 10us per begin/end pair), since it immediately serializes the data to a per-core trace buffer in Kernel owned memory.
Because they're expensive, we generally recommend starting with something minimal, like blocks for UI portion of frame, GPU portion of frame, and any expensive blocks of code like image decode, upload, or compositing operations. Typically want to have a couple dozen events per frame, more than that we've found to be too intrusive.
As discussed offline, this pushes events to systrace instead of the VM's trace buffer, so it would make Observatory show an empty timeline. A flag seems preferable, and would also make it easier to switch to the "startup" recorder when needed.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
eseidelGoogle commentedon Jun 4, 2018
I believe Flutter just sits on top of Dart's tracing: https://github.com/flutter/engine/blob/master/fml/trace_event.cc. Maybe the Dart SDK should know how to plumb trace events down to systrace on Android?
Depends I guess on if the expectations of "expensive" are compatible or not. Flutter's tracing by default may be too chatty.
Hixie commentedon Jun 4, 2018
cc @a-siva
Hixie commentedon Jun 4, 2018
cc @rmacnak-google
rmacnak-google commentedon Jun 4, 2018
The VM already supports this. The engine can direct timeline events to Android systrace by setting
--timeline_recorder=systracein the VM flags.chinmaygarde commentedon Jun 5, 2018
@rmacnak-google: I can turn this on by default on Android. Will this also trace to observatory UI?
rmacnak-google commentedon Jun 5, 2018
As discussed offline, this pushes events to systrace instead of the VM's trace buffer, so it would make Observatory show an empty timeline. A flag seems preferable, and would also make it easier to switch to the "startup" recorder when needed.
Hixie commentedon Jun 5, 2018
Can we just always send to both?
Hixie commentedon Jun 5, 2018
(Or have the Observatory fetch the systrace?)
Manual roll of engine 7e205b3...3953c3c
Manual roll of engine 7e205b3...3953c3c
Manual roll of engine 7e205b3...3953c3c (#56677)
github-actions commentedon Aug 15, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.