Skip to content

Commit

Permalink
[fuchsia] Add trace flow for Flatland::Present (flutter#38565)
Browse files Browse the repository at this point in the history
  • Loading branch information
uysalere authored Dec 29, 2022
1 parent 1752b5b commit a63bd85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit a63bd85

Please sign in to comment.