diff --git a/common/settings.h b/common/settings.h index 8a12ebb98f055..39017dbc1cd40 100644 --- a/common/settings.h +++ b/common/settings.h @@ -301,11 +301,6 @@ struct Settings { // Max bytes threshold of resource cache, or 0 for unlimited. size_t resource_cache_max_bytes_threshold = 0; - /// A timestamp representing when the engine started. The value is based - /// on the clock used by the Dart timeline APIs. This timestamp is used - /// to log a timeline event that tracks the latency of engine startup. - std::chrono::microseconds engine_start_timestamp = {}; - /// The minimum number of samples to require in multipsampled anti-aliasing. /// /// Setting this value to 0 or 1 disables MSAA. diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index fc5dded31462f..829e4be21f26f 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -467,19 +467,19 @@ DartVM::DartVM(std::shared_ptr vm_data, // Send the earliest available timestamp in the application lifecycle to // timeline. The difference between this timestamp and the time we render // the very first frame gives us a good idea about Flutter's startup time. - // Use a duration event so about:tracing will consider this event when - // deciding the earliest event to use as time 0. - if (settings_.engine_start_timestamp.count()) { - Dart_TimelineEvent( - "FlutterEngineMainEnter", // label - settings_.engine_start_timestamp.count(), // timestamp0 - Dart_TimelineGetMicros(), // timestamp1_or_async_id - Dart_Timeline_Event_Duration, // event type - 0, // argument_count - nullptr, // argument_names - nullptr // argument_values - ); - } + // Use an instant event because the call to Dart_TimelineGetMicros + // may behave differently before and after the Dart VM is initialized. + // As this call is immediately after initialization of the Dart VM, + // we are interested in only one timestamp. + int64_t micros = Dart_TimelineGetMicros(); + Dart_TimelineEvent("FlutterEngineMainEnter", // label + micros, // timestamp0 + micros, // timestamp1_or_async_id + Dart_Timeline_Event_Instant, // event type + 0, // argument_count + nullptr, // argument_names + nullptr // argument_values + ); } Dart_SetFileModifiedCallback(&DartFileModifiedCallback); diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 25ad7d7f94332..50f81d8d57b92 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -84,11 +84,6 @@ void PerformInitializationTasks(Settings& settings) { static std::once_flag gShellSettingsInitialization = {}; std::call_once(gShellSettingsInitialization, [&settings] { - if (settings.engine_start_timestamp.count() == 0) { - settings.engine_start_timestamp = - std::chrono::microseconds(Dart_TimelineGetMicros()); - } - tonic::SetLogHandler( [](const char* message) { FML_LOG(ERROR) << message; }); diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 929b00fdab7c9..99c7d052df26d 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -111,10 +111,6 @@ void FlutterMain::Init(JNIEnv* env, settings.enable_timeline_event_handler = settings.trace_systrace; #endif // FLUTTER_RELEASE - int64_t init_time_micros = initTimeMillis * 1000; - settings.engine_start_timestamp = - std::chrono::microseconds(Dart_TimelineGetMicros() - init_time_micros); - // Restore the callback cache. // TODO(chinmaygarde): Route all cache file access through FML and remove this // setter.