From 6301223ceeb13906436041f421bdfe1c5bbfb941 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 25 Mar 2021 16:59:00 -0500 Subject: [PATCH] [tracing] Add trace events for DartIsolate::HandleMessage (flutter/engine#25241) This captures majority of the non frame related workload happening on the UI thread. --- engine/src/flutter/runtime/dart_isolate.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/runtime/dart_isolate.cc b/engine/src/flutter/runtime/dart_isolate.cc index d5e70379bbc..658423f178c 100644 --- a/engine/src/flutter/runtime/dart_isolate.cc +++ b/engine/src/flutter/runtime/dart_isolate.cc @@ -445,8 +445,13 @@ void DartIsolate::SetMessageHandlingTaskRunner( message_handling_task_runner_ = runner; - message_handler().Initialize( - [runner](std::function task) { runner->PostTask(task); }); + message_handler().Initialize([runner](std::function task) { + TRACE_EVENT0("flutter", "DartIsolate::PostMessage"); + runner->PostTask([task = std::move(task)]() { + TRACE_EVENT0("flutter", "DartIsolate::HandleMessage"); + task(); + }); + }); } // Updating thread names here does not change the underlying OS thread names.