Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

[fuchsia] Add trace flow for Flatland::Present #38565

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions shell/platform/fuchsia/flutter/flatland_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <zircon/status.h>

#include "flutter/fml/logging.h"
#include "flutter/fml/trace_event.h"

namespace flutter_runner {

Expand Down Expand Up @@ -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_;

Expand Down
3 changes: 3 additions & 0 deletions shell/platform/fuchsia/flutter/flatland_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down