Commit 15ab8559 authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Record the GPU watchdog arm_disarm_counter in the main thread

It is for the debugging purpose only and it wil have a performance impact.
The code will be removed immediately once valid crash dumps are collected.

Bug: 885066,885066
Change-Id: Ie8761ed4e6050a07e76af0a030b67dab5bb011e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129028
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756461}
parent 041a7df7
......@@ -378,7 +378,12 @@ void GpuWatchdogThreadImplV2::UpdateInitializationFlag() {
void GpuWatchdogThreadImplV2::Arm() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
if (hits_termination_.IsSet()) {
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
} else {
arm_disarm_counter_main_thread_ =
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
}
// Arm/Disarm are always called in sequence. Now it's an odd number.
DCHECK(IsArmed());
......@@ -387,7 +392,12 @@ void GpuWatchdogThreadImplV2::Arm() {
void GpuWatchdogThreadImplV2::Disarm() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
if (hits_termination_.IsSet()) {
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
} else {
arm_disarm_counter_main_thread_ =
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
}
// Arm/Disarm are always called in sequence. Now it's an even number.
DCHECK(!IsArmed());
......@@ -397,7 +407,13 @@ void GpuWatchdogThreadImplV2::InProgress() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
// Increment by 2. This is equivalent to Disarm() + Arm().
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 2);
if (hits_termination_.IsSet()) {
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 2);
} else {
arm_disarm_counter_main_thread_ =
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 2);
}
// Now it's an odd number.
DCHECK(IsArmed());
......@@ -586,6 +602,10 @@ void GpuWatchdogThreadImplV2::DeliberatelyTerminateToRecoverFromHang() {
return;
}
// Debug only. To be deleted
hits_termination_.Set();
base::debug::Alias(&arm_disarm_counter_main_thread_);
#if defined(OS_WIN)
if (IsDebuggerPresent())
return;
......
......@@ -227,6 +227,11 @@ class GPU_IPC_SERVICE_EXPORT GpuWatchdogThreadImplV2
bool foregrounded_event_ = false;
bool power_resumed_event_ = false;
// TODO (magche@): Debugging only. This has a measurable performance impact
// and should be removed once valid crash dumps are collected.
base::AtomicFlag hits_termination_;
base::subtle::Atomic32 arm_disarm_counter_main_thread_ = 0;
// For gpu testing only.
const bool is_test_mode_;
// Set by the watchdog thread and Read by the test thread.
......
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