Commit e6b5e253 authored by jbauman's avatar jbauman Committed by Commit bot

Save variables on stack to help determine why GPU watchdog is firing.

Grab the current time in various formats so we can compare how long it's
been since the last ack.

Also use QueryUnbiasedInterruptTime to determine whether the computer
has been suspended recently.

BUG=588342

Review URL: https://codereview.chromium.org/1804303002

Cr-Commit-Position: refs/heads/master@{#381656}
parent 36d84e54
......@@ -11,6 +11,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/macros.h"
......@@ -208,9 +209,12 @@ void GpuWatchdogThread::OnCheck(bool after_suspend) {
#if defined(OS_WIN)
arm_cpu_time_ = GetWatchedThreadTime();
QueryUnbiasedInterruptTime(&arm_interrupt_time_);
#endif
check_time_ = base::Time::Now();
check_timeticks_ = base::TimeTicks::Now();
// Immediately after the computer is woken up from being suspended it might
// be pretty sluggish, so allow some extra time before the next timeout.
base::TimeDelta timeout = timeout_ * (after_suspend ? 3 : 1);
......@@ -333,6 +337,28 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
}
#endif
// Store variables so they're available in crash dumps to help determine the
// cause of any hang.
#if defined(OS_WIN)
ULONGLONG fire_interrupt_time;
QueryUnbiasedInterruptTime(&fire_interrupt_time);
// This is the time since the watchdog was armed, in 100ns intervals,
// ignoring time where the computer is suspended.
ULONGLONG interrupt_delay = fire_interrupt_time - arm_interrupt_time_;
base::debug::Alias(&interrupt_delay);
base::debug::Alias(&time_since_arm);
bool using_high_res_timer = base::Time::IsHighResolutionTimerInUse();
base::debug::Alias(&using_high_res_timer);
#endif
base::Time current_time = base::Time::Now();
base::TimeTicks current_timeticks = base::TimeTicks::Now();
base::debug::Alias(&current_time);
base::debug::Alias(&current_timeticks);
LOG(ERROR) << "The GPU process hung. Terminating after "
<< timeout_.InMilliseconds() << " ms.";
......
......@@ -108,6 +108,10 @@ class GpuWatchdogThread : public base::Thread,
#if defined(OS_WIN)
void* watched_thread_handle_;
base::TimeDelta arm_cpu_time_;
// This measures the time that the system has been running, in units of 100
// ns.
ULONGLONG arm_interrupt_time_;
#endif
// Time after which it's assumed that the computer has been suspended since
......@@ -118,6 +122,7 @@ class GpuWatchdogThread : public base::Thread,
// This is the time the last check was sent.
base::Time check_time_;
base::TimeTicks check_timeticks_;
#if defined(OS_CHROMEOS)
FILE* tty_file_;
......
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