Commit 057d5553 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

cc: Dump more state in begin main frame hang crash key.

This dumps more state notably including time since last begin frame and
the last few actions.

TBR=brianderson
BUG=622080

Change-Id: I51590aa3e2859b448ca2eafd45046f6f123e9331
Reviewed-on: https://chromium-review.googlesource.com/571286Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486670}
parent 1cff10ce
......@@ -12,6 +12,7 @@
#include "base/memory/ptr_util.h"
#include "base/profiler/scoped_tracker.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
#include "cc/base/devtools_instrumentation.h"
......@@ -270,6 +271,10 @@ void Scheduler::OnBeginFrameSourcePausedChanged(bool paused) {
bool Scheduler::OnBeginFrameDerivedImpl(const BeginFrameArgs& args) {
TRACE_EVENT1("cc,benchmark", "Scheduler::BeginFrame", "args", args.AsValue());
// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang.
// TODO(sunnyps): Remove after fixing https://crbug.com/622080
debug_begin_frame_received_at_ = Now();
if (!state_machine_.BeginFrameNeeded()) {
TRACE_EVENT_INSTANT0("cc", "Scheduler::BeginFrameDropped",
TRACE_EVENT_SCOPE_THREAD);
......@@ -690,6 +695,12 @@ void Scheduler::ProcessScheduledActions() {
break;
}
}
// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang.
// TODO(sunnyps): Remove after fixing https://crbug.com/622080
if (action != SchedulerStateMachine::ACTION_NONE) {
debug_actions_.SaveToBuffer(action);
}
} while (action != SchedulerStateMachine::ACTION_NONE);
ScheduleBeginImplFrameDeadlineIfNeeded();
......@@ -697,9 +708,16 @@ void Scheduler::ProcessScheduledActions() {
// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang.
// TODO(sunnyps): Remove after fixing https://crbug.com/622080
base::debug::SetCrashKeyValue(
kBeginMainFrameHangCompositorState,
state_machine_.CrashKeyValueForBeginMainFrameHang());
std::string state_dump = state_machine_.CrashKeyValueForBeginMainFrameHang();
base::StringAppendF(
&state_dump, ",%f,%d,%d,%d",
(Now() - debug_begin_frame_received_at_).InMillisecondsF(),
skipped_last_frame_to_reduce_latency_,
skipped_last_frame_missed_exceeded_deadline_, stopped_);
for (auto it = debug_actions_.Begin(); it; ++it)
base::StringAppendF(&state_dump, ",%d", **it);
base::debug::SetCrashKeyValue(kBeginMainFrameHangCompositorState, state_dump);
}
std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
......
......@@ -12,6 +12,7 @@
#include "base/cancelable_callback.h"
#include "base/macros.h"
#include "base/time/time.h"
#include "cc/base/ring_buffer.h"
#include "cc/cc_export.h"
#include "cc/output/begin_frame_args.h"
#include "cc/scheduler/begin_frame_source.h"
......@@ -198,6 +199,11 @@ class CC_EXPORT Scheduler : public BeginFrameObserverBase {
SchedulerStateMachine::Action inside_action_ =
SchedulerStateMachine::ACTION_NONE;
// TEMPORARY: Compositor state for debugging BeginMainFrame renderer hang.
// TODO(sunnyps): Remove after fixing https://crbug.com/622080
base::TimeTicks debug_begin_frame_received_at_;
RingBuffer<SchedulerStateMachine::Action, 10> debug_actions_;
bool stopped_ = false;
private:
......
......@@ -241,11 +241,12 @@ void SchedulerStateMachine::AsValueInto(
// TODO(sunnyps): Remove after fixing https://crbug.com/622080
std::string SchedulerStateMachine::CrashKeyValueForBeginMainFrameHang() const {
return base::StringPrintf(
"%d,%d,%d,%d,%d,%d,%d,%d,%d", begin_impl_frame_state_,
"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", begin_impl_frame_state_,
begin_main_frame_state_, layer_tree_frame_sink_state_,
pending_submit_frames_, visible_, has_pending_tree_,
pending_tree_is_ready_for_activation_, active_tree_needs_first_draw_,
begin_frame_source_paused_);
begin_frame_source_paused_, needs_redraw_, needs_prepare_tiles_,
needs_one_begin_impl_frame_);
}
bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
......
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