From 5a22d0be5050bb08ff3dbc9fd09c049bf8b4d0a1 Mon Sep 17 00:00:00 2001 From: chaopeng Date: Mon, 18 Mar 2024 18:51:31 -0400 Subject: [PATCH] [Fuchsia] Support per app present latency tracing Bug: http://b/323408867 --- shell/platform/fuchsia/flutter/flatland_connection.cc | 6 +++++- shell/platform/fuchsia/flutter/flatland_connection.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/platform/fuchsia/flutter/flatland_connection.cc b/shell/platform/fuchsia/flutter/flatland_connection.cc index cfc7ea0923455..6a45b8b44e83c 100644 --- a/shell/platform/fuchsia/flutter/flatland_connection.cc +++ b/shell/platform/fuchsia/flutter/flatland_connection.cc @@ -33,6 +33,7 @@ FlatlandConnection::FlatlandConnection( FML_LOG(ERROR) << "Flatland disconnected: " << zx_status_get_string(status); callback(); }); + debug_label_ = debug_label; flatland_->SetDebugName(debug_label); flatland_.events().OnError = fit::bind_member(this, &FlatlandConnection::OnError); @@ -58,7 +59,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_); + + std::string per_app_tracing_name = + "Flatland::PerAppPresent[" + debug_label_ + "]"; + TRACE_FLOW_BEGIN("gfx", per_app_tracing_name.c_str(), next_present_trace_id_); ++next_present_trace_id_; FML_CHECK(threadsafe_state_.present_credits_ > 0); diff --git a/shell/platform/fuchsia/flutter/flatland_connection.h b/shell/platform/fuchsia/flutter/flatland_connection.h index 87020058db6df..59c67e14f430e 100644 --- a/shell/platform/fuchsia/flutter/flatland_connection.h +++ b/shell/platform/fuchsia/flutter/flatland_connection.h @@ -105,6 +105,7 @@ class FlatlandConnection final { std::vector acquire_fences_; std::vector current_present_release_fences_; std::vector previous_present_release_fences_; + std::string debug_label_; FML_DISALLOW_COPY_AND_ASSIGN(FlatlandConnection); };