Unverified Commit dd6dd7ae authored by Jia Hao's avatar Jia Hao Committed by GitHub

Fix tracing of startup events (#59982)

When `retainPriorEvents` is passed as true, the current behavior still limits timeline events to the timestamp after `traceEvents` is called. This can cause startup events to be missing.

This fixes it by passing null to `stopTracingAndDownloadTimeline` for the start and end time.

Related: #58430
parent 55abbb6b
...@@ -464,9 +464,19 @@ class VMServiceFlutterDriver extends FlutterDriver { ...@@ -464,9 +464,19 @@ class VMServiceFlutterDriver extends FlutterDriver {
List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all], List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
bool retainPriorEvents = false, bool retainPriorEvents = false,
}) async { }) async {
if (!retainPriorEvents) { if (retainPriorEvents) {
await clearTimeline(); await startTracing(streams: streams);
await action();
if (!(await _isPrecompiledMode())) {
_log(_kDebugWarning);
}
return stopTracingAndDownloadTimeline();
} }
await clearTimeline();
final Map<String, Object> startTimestamp = await _getVMTimelineMicros(); final Map<String, Object> startTimestamp = await _getVMTimelineMicros();
await startTracing(streams: streams); await startTracing(streams: streams);
await action(); await action();
......
...@@ -574,10 +574,8 @@ void main() { ...@@ -574,10 +574,8 @@ void main() {
}, retainPriorEvents: true); }, retainPriorEvents: true);
expect(log, const <String>[ expect(log, const <String>[
'getVMTimelineMicros',
'startTracing', 'startTracing',
'action', 'action',
'getVMTimelineMicros',
'stopTracing', 'stopTracing',
'download', 'download',
]); ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment