[Fuchsia] Support per app present latency tracing (flutter/engine#51503)

Bug: http://b/323408867
This commit is contained in:
巢鹏
2024-04-11 16:19:21 -04:00
committed by GitHub
parent e5d0cae6cd
commit b935b22302
2 changed files with 6 additions and 1 deletions

View File

@@ -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);

View File

@@ -105,6 +105,7 @@ class FlatlandConnection final {
std::vector<zx::event> acquire_fences_;
std::vector<zx::event> current_present_release_fences_;
std::vector<zx::event> previous_present_release_fences_;
std::string debug_label_;
FML_DISALLOW_COPY_AND_ASSIGN(FlatlandConnection);
};