Skip to content

Commit

Permalink
Add a few extra temporary crash keys at GPU watchdog kill time.
Browse files Browse the repository at this point in the history
We want to know if some hangs are caused by a suspension.

Also, we want to know if the last logging at kill time could
cause issues (if it takes much longer than expected).

BUG=885066
TEST=bots
R=piman@chromium.org

Change-Id: I4c199a993d7824692374d97a923ce6a41b9640ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1555505
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648435}
  • Loading branch information
zhenyao authored and Commit Bot committed Apr 6, 2019
1 parent ff4adac commit 8a060f5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
6 changes: 6 additions & 0 deletions gpu/config/gpu_crash_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ crash_reporter::CrashKeyString<4> gpu_gl_context_is_virtual(
"gpu-gl-context-is-virtual");
crash_reporter::CrashKeyString<20> seconds_since_last_progress_report(
"seconds-since-last-progress-report");
crash_reporter::CrashKeyString<20> seconds_since_last_suspend(
"seconds-since-last-suspend");
crash_reporter::CrashKeyString<20> seconds_since_last_resume(
"seconds-since-last-resume");
crash_reporter::CrashKeyString<20> seconds_since_last_logging(
"seconds-since-last-logging");
crash_reporter::CrashKeyString<20> available_physical_memory_in_mb(
"available-physical-memory-in-mb");

Expand Down
3 changes: 3 additions & 0 deletions gpu/config/gpu_crash_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ extern GPU_EXPORT crash_reporter::CrashKeyString<128> gpu_renderer;
extern GPU_EXPORT crash_reporter::CrashKeyString<4> gpu_gl_context_is_virtual;
extern GPU_EXPORT crash_reporter::CrashKeyString<20>
seconds_since_last_progress_report;
extern GPU_EXPORT crash_reporter::CrashKeyString<20> seconds_since_last_suspend;
extern GPU_EXPORT crash_reporter::CrashKeyString<20> seconds_since_last_resume;
extern GPU_EXPORT crash_reporter::CrashKeyString<20> seconds_since_last_logging;
extern GPU_EXPORT crash_reporter::CrashKeyString<20>
available_physical_memory_in_mb;

Expand Down
26 changes: 21 additions & 5 deletions gpu/ipc/service/gpu_watchdog_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,15 +496,12 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
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);

int32_t awaiting_acknowledge =
base::subtle::NoBarrier_Load(&awaiting_acknowledge_);
base::debug::Alias(&awaiting_acknowledge);

base::TimeTicks before_logging_timeticks = base::TimeTicks::Now();

// Don't log the message to stderr in release builds because the buffer
// may be full.
std::string message = base::StringPrintf(
Expand All @@ -515,10 +512,27 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
handler(logging::LOG_ERROR, __FILE__, __LINE__, 0, message);
DLOG(ERROR) << message;

base::Time current_time = base::Time::Now();
base::TimeTicks current_timeticks = base::TimeTicks::Now();
base::debug::Alias(&current_time);
base::debug::Alias(&current_timeticks);

int64_t since_last_logging =
(current_timeticks - before_logging_timeticks).InSeconds();
crash_keys::seconds_since_last_logging.Set(
base::NumberToString(since_last_logging));
int64_t since_last_progress_report =
(current_timeticks - last_reported_progress_timeticks_).InSeconds();
crash_keys::seconds_since_last_progress_report.Set(
base::NumberToString(since_last_progress_report));
int64_t since_last_suspend =
(current_timeticks - last_suspend_timeticks_).InSeconds();
crash_keys::seconds_since_last_suspend.Set(
base::NumberToString(since_last_suspend));
int64_t since_last_resume =
(current_timeticks - last_resume_timeticks_).InSeconds();
crash_keys::seconds_since_last_resume.Set(
base::NumberToString(since_last_resume));

int64_t available_physical_memory =
base::SysInfo::AmountOfAvailablePhysicalMemory() >> 20;
Expand Down Expand Up @@ -573,10 +587,12 @@ void GpuWatchdogThread::OnAddPowerObserver() {
}

void GpuWatchdogThread::OnSuspend() {
last_suspend_timeticks_ = base::TimeTicks::Now();
power_suspend_ref_ = suspension_counter_.Take();
}

void GpuWatchdogThread::OnResume() {
last_resume_timeticks_ = base::TimeTicks::Now();
power_suspend_ref_.reset();
}

Expand Down
2 changes: 2 additions & 0 deletions gpu/ipc/service/gpu_watchdog_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ class GPU_IPC_SERVICE_EXPORT GpuWatchdogThread : public base::Thread,
base::TimeTicks check_timeticks_;

base::TimeTicks last_reported_progress_timeticks_;
base::TimeTicks last_suspend_timeticks_;
base::TimeTicks last_resume_timeticks_;

#if defined(USE_X11)
XDisplay* display_;
Expand Down

0 comments on commit 8a060f5

Please sign in to comment.