-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
1. Background
Timeline can't view cpu and other related system information, which is very important for performance analysis. Especially the flutter hybrid project, you need to check platform trace and flutter trace at the same time.
2. Issues
Make timeline support for systrace to assist in analyzing performance issues.
- systrace don't support async timeline events dart-lang/sdk#39726
- support vm events available to systrace dart-lang/sdk#39757
- support more sync event when change timeline reccord to systrace dart-lang/sdk#39727
- Support timeline conversion to iOS platform trace dart-lang/sdk#40076
3. Solutions
dart-sdk repository
- support async events for systrace: https://dart-review.googlesource.com/c/sdk/+/127920
- support dart vm events for systrace: https://dart-review.googlesource.com/c/sdk/+/128200
- support sync events for systrace: https://dart-review.googlesource.com/c/sdk/+/127921
- support iOS platform trace: https://dart-review.googlesource.com/c/sdk/+/131360
engine repository
- support API stream for systrace: Fix missing API stream when record event in systrace engine#14323
- timeline can be enabled in release mode: Support timeline can be enabled in release mode engine#14521
- Fix missing timeline event of flutter engine's startup time: Fix missing timeline event of flutter engine's startup time engine#14319
flutter repository
- fix duration event of timeline summary: fix duration event of timeline summary #47742
4. Results
flutter run --trace-systrace , capture systrace as below:
After optimization. We can see the synchronous and asynchronous events of the dart and c++ layers, as below:

Later, I will further share which flutter performance issues only systrace can find the root cause in Android, and timeline is incapable. Because timeline does not capture system traces and CPU schedules, such as surfaceFlinger.
