Add logging when first frame is not rendering (#99566)

This commit is contained in:
Jenn Magder 2022-03-04 17:16:21 -08:00 committed by GitHub
parent f1d88586e0
commit 7596a3daf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import 'base/error_handling_io.dart';
import 'base/file_system.dart';
import 'base/logger.dart';
import 'base/utils.dart';
import 'convert.dart';
import 'vmservice.dart';
// Names of some of the Timeline events we care about.
@ -72,11 +73,25 @@ class Tracing {
}
}
if (!done) {
final Timer timer = Timer(const Duration(seconds: 10), () {
final Timer timer = Timer(const Duration(seconds: 10), () async {
_logger.printStatus('First frame is taking longer than expected...');
_logger.printTrace('Views:');
for (final FlutterView view in views) {
_logger.printTrace('id: ${view.id} isolate: ${view.uiIsolate?.id}');
final String? isolateId = view.uiIsolate?.id;
_logger.printTrace('View ID: ${view.id}');
if (isolateId == null) {
_logger.printTrace('No isolate ID associated with the view.');
continue;
}
final vm_service.Isolate? isolate = await vmService.getIsolateOrNull(isolateId);
if (isolate == null) {
_logger.printTrace('Isolate $isolateId not found.');
continue;
}
_logger.printTrace('Isolate $isolateId state:');
final Map<String, Object?> isolateState = isolate.toJson();
// "libraries" has very long output and is likely unrelated to any first-frame issues.
isolateState.remove('libraries');
_logger.printTrace(jsonEncode(isolateState));
}
_logger.printTrace('Received VM events:');
_logger.printTrace(bufferedEvents.toString());

View File

@ -232,7 +232,8 @@ void main() {
return completer.future;
});
expect(logger.statusText, contains('First frame is taking longer than expected'));
expect(logger.traceText, contains('id: 1 isolate: null'));
expect(logger.traceText, contains('View ID: 1'));
expect(logger.traceText, contains('No isolate ID associated with the view'));
expect(logger.traceText, contains('Flutter.Error: [ExtensionData {test: data, renderedErrorText: error text}]'));
});