From 55c290734e02b5d32444591ee47b1e341b85e334 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 25 Mar 2021 13:00:06 -0700 Subject: [PATCH] Highlight VSync support for embedders Chrome Trace viewer treats events labeled "VSYNC" as special and highlights them (when the "Highlight Vsync" checkbox is enabled). Ideally VSYNC events are generated by the host system at their source. System VSYNC events are indeed present in full-system systraces. Flutter-level traces (as seen in Observatory/Flutter devtools) do not contain the system VSYNC events, so we rely on the engine to generate them (as close to where they would be generated by the system ideally). --- shell/common/vsync_waiter_fallback.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/common/vsync_waiter_fallback.cc b/shell/common/vsync_waiter_fallback.cc index fc23c6180a4ff..514dc02fac5e6 100644 --- a/shell/common/vsync_waiter_fallback.cc +++ b/shell/common/vsync_waiter_fallback.cc @@ -5,6 +5,7 @@ #include "flutter/shell/common/vsync_waiter_fallback.h" #include "flutter/fml/logging.h" +#include "flutter/fml/trace_event.h" namespace flutter { namespace { @@ -27,6 +28,8 @@ VsyncWaiterFallback::~VsyncWaiterFallback() = default; // |VsyncWaiter| void VsyncWaiterFallback::AwaitVSync() { + TRACE_EVENT0("flutter", "VSYNC"); + constexpr fml::TimeDelta kSingleFrameInterval = fml::TimeDelta::FromSecondsF(1.0 / 60.0);