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
This commit is contained in:
Jia Hao 2020-06-23 08:07:05 +08:00 committed by GitHub
parent 55abbb6be6
commit dd6dd7aef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -464,9 +464,19 @@ class VMServiceFlutterDriver extends FlutterDriver {
List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
bool retainPriorEvents = false,
}) async {
if (!retainPriorEvents) {
await clearTimeline();
if (retainPriorEvents) {
await startTracing(streams: streams);
await action();
if (!(await _isPrecompiledMode())) {
_log(_kDebugWarning);
}
return stopTracingAndDownloadTimeline();
}
await clearTimeline();
final Map<String, Object> startTimestamp = await _getVMTimelineMicros();
await startTracing(streams: streams);
await action();

View File

@ -574,10 +574,8 @@ void main() {
}, retainPriorEvents: true);
expect(log, const <String>[
'getVMTimelineMicros',
'startTracing',
'action',
'getVMTimelineMicros',
'stopTracing',
'download',
]);