Engine startup event timed after VM initializes (flutter/engine#35713)
* Engine startup event timed after VM initializes * Formatting * Update FlutterEngineMainEnter event comment * Remove engine_start_time * Remove unused variable
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -467,19 +467,19 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> 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);
|
||||
|
||||
@@ -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; });
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user