Commit c3119ad1 authored by Klaus Weidner's avatar Klaus Weidner Committed by Commit Bot

Emit VSync time markers in WebVR for event trace log

During presentation, the normal compositor VSync loop which usually
provides VSync markers for event logs is disabled. Since these are
useful for debugging timing, synthesize them in our OnVSync.

Bug: 
Change-Id: Id87d337859a1fdf028d8ba01a76a10d3cfabcf8a
Reviewed-on: https://chromium-review.googlesource.com/679776Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504424}
parent 1dac4dbd
......@@ -15,6 +15,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event_argument.h"
#include "chrome/browser/android/vr_shell/gl_browser_interface.h"
#include "chrome/browser/android/vr_shell/gvr_util.h"
#include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h"
......@@ -1122,6 +1123,21 @@ void VrShellGl::SetControllerModel(
}
void VrShellGl::OnVSync(base::TimeTicks frame_time) {
TRACE_EVENT0("gpu", "VrShellGl::OnVSync");
// Create a synthetic VSync trace event for the reported last-VSync time. Use
// this specific type since it appears to be the only one which supports
// supplying a timestamp different from the current time, which is useful
// since we seem to be >1ms behind the vsync time when we receive this call.
//
// See third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor.html
std::unique_ptr<base::trace_event::TracedValue> args =
base::MakeUnique<base::trace_event::TracedValue>();
args->SetDouble(
"frame_time_us",
static_cast<double>((frame_time - base::TimeTicks()).InMicroseconds()));
TRACE_EVENT_INSTANT1("viz", "DisplayScheduler::BeginFrame",
TRACE_EVENT_SCOPE_THREAD, "args", std::move(args));
while (premature_received_frames_ > 0) {
TRACE_EVENT0("gpu", "VrShellGl::OnWebVRFrameAvailableRetry");
--premature_received_frames_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment