Unverified Commit 41cc80c5 authored by Mehmet Fidanboylu's avatar Mehmet Fidanboylu Committed by GitHub

Expose the timeline event names so they can be used in other systems that do tracing (#37863)

parent f1ea4850
...@@ -12,15 +12,15 @@ import 'globals.dart'; ...@@ -12,15 +12,15 @@ import 'globals.dart';
import 'vmservice.dart'; import 'vmservice.dart';
// Names of some of the Timeline events we care about. // Names of some of the Timeline events we care about.
const String _kFlutterEngineMainEnterEventName = 'FlutterEngineMainEnter'; const String kFlutterEngineMainEnterEventName = 'FlutterEngineMainEnter';
const String _kFrameworkInitEventName = 'Framework initialization'; const String kFrameworkInitEventName = 'Framework initialization';
const String _kFirstFrameBuiltEventName = 'Widgets built first useful frame'; const String kFirstFrameBuiltEventName = 'Widgets built first useful frame';
const String _kFirstFrameRasterizedEventName = 'Rasterized first useful frame'; const String kFirstFrameRasterizedEventName = 'Rasterized first useful frame';
class Tracing { class Tracing {
Tracing(this.vmService); Tracing(this.vmService);
static const String firstUsefulFrameEventName = _kFirstFrameRasterizedEventName; static const String firstUsefulFrameEventName = kFirstFrameRasterizedEventName;
static Future<Tracing> connect(Uri uri) async { static Future<Tracing> connect(Uri uri) async {
final VMService observatory = await VMService.connect(uri); final VMService observatory = await VMService.connect(uri);
...@@ -104,8 +104,8 @@ Future<void> downloadStartupTrace(VMService observatory, { bool awaitFirstFrame ...@@ -104,8 +104,8 @@ Future<void> downloadStartupTrace(VMService observatory, { bool awaitFirstFrame
String message = 'No useful metrics were gathered.'; String message = 'No useful metrics were gathered.';
final int engineEnterTimestampMicros = extractInstantEventTimestamp(_kFlutterEngineMainEnterEventName); final int engineEnterTimestampMicros = extractInstantEventTimestamp(kFlutterEngineMainEnterEventName);
final int frameworkInitTimestampMicros = extractInstantEventTimestamp(_kFrameworkInitEventName); final int frameworkInitTimestampMicros = extractInstantEventTimestamp(kFrameworkInitEventName);
if (engineEnterTimestampMicros == null) { if (engineEnterTimestampMicros == null) {
printTrace('Engine start event is missing in the timeline: $timeline'); printTrace('Engine start event is missing in the timeline: $timeline');
...@@ -123,8 +123,8 @@ Future<void> downloadStartupTrace(VMService observatory, { bool awaitFirstFrame ...@@ -123,8 +123,8 @@ Future<void> downloadStartupTrace(VMService observatory, { bool awaitFirstFrame
} }
if (awaitFirstFrame) { if (awaitFirstFrame) {
final int firstFrameBuiltTimestampMicros = extractInstantEventTimestamp(_kFirstFrameBuiltEventName); final int firstFrameBuiltTimestampMicros = extractInstantEventTimestamp(kFirstFrameBuiltEventName);
final int firstFrameRasterizedTimestampMicros = extractInstantEventTimestamp(_kFirstFrameRasterizedEventName); final int firstFrameRasterizedTimestampMicros = extractInstantEventTimestamp(kFirstFrameRasterizedEventName);
if (firstFrameBuiltTimestampMicros == null || firstFrameRasterizedTimestampMicros == null) { if (firstFrameBuiltTimestampMicros == null || firstFrameRasterizedTimestampMicros == null) {
printTrace('First frame events are missing in the timeline: $timeline'); printTrace('First frame events are missing in the timeline: $timeline');
throw 'First frame events are missing in the timeline. Cannot compute startup time.'; throw 'First frame events are missing in the timeline. Cannot compute startup time.';
......
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