From a63bd854ac5aed6c8b3cb12004901d2246fad8f5 Mon Sep 17 00:00:00 2001 From: Emircan Uysaler Date: Thu, 29 Dec 2022 15:52:09 -0500 Subject: [PATCH] [fuchsia] Add trace flow for Flatland::Present (#38565) --- shell/platform/fuchsia/flutter/flatland_connection.cc | 5 +++++ shell/platform/fuchsia/flutter/flatland_connection.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/shell/platform/fuchsia/flutter/flatland_connection.cc b/shell/platform/fuchsia/flutter/flatland_connection.cc index 710dd0bd2e7c0..500783e20b370 100644 --- a/shell/platform/fuchsia/flutter/flatland_connection.cc +++ b/shell/platform/fuchsia/flutter/flatland_connection.cc @@ -7,6 +7,7 @@ #include #include "flutter/fml/logging.h" +#include "flutter/fml/trace_event.h" namespace flutter_runner { @@ -61,6 +62,10 @@ void FlatlandConnection::Present() { // This method is called from the raster thread. void FlatlandConnection::DoPresent() { + TRACE_DURATION("flutter", "FlatlandConnection::DoPresent"); + TRACE_FLOW_BEGIN("gfx", "Flatland::Present", next_present_trace_id_); + ++next_present_trace_id_; + FML_CHECK(present_credits_ > 0); --present_credits_; diff --git a/shell/platform/fuchsia/flutter/flatland_connection.h b/shell/platform/fuchsia/flutter/flatland_connection.h index 46efd45483d42..b66c8f99fabd5 100644 --- a/shell/platform/fuchsia/flutter/flatland_connection.h +++ b/shell/platform/fuchsia/flutter/flatland_connection.h @@ -81,6 +81,9 @@ class FlatlandConnection final { uint32_t present_credits_ = 1; bool present_pending_ = false; + // A flow event trace id for following |Flatland::Present| calls into Scenic. + uint64_t next_present_trace_id_ = 0; + // This struct contains state that is accessed from both from the UI thread // (in AwaitVsync) and the raster thread (in OnNextFrameBegin and Present). // You should always lock mutex_ before touching anything in this struct