| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/gpu/gpu_watchdog_thread.h" | 5 #include "content/gpu/gpu_watchdog_thread.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 #include <stdint.h> |
| 9 #if defined(OS_WIN) | |
| 10 #include <windows.h> | |
| 11 #endif | |
| 12 | 9 |
| 13 #include "base/bind.h" | 10 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 15 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 16 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 17 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 18 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" |
| 19 #include "base/power_monitor/power_monitor.h" | 17 #include "base/power_monitor/power_monitor.h" |
| 20 #include "base/process/process.h" | 18 #include "base/process/process.h" |
| 21 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 22 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 23 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/common/result_codes.h" | 22 #include "content/public/common/result_codes.h" |
| 25 | 23 |
| 24 #if defined(OS_WIN) |
| 25 #include <windows.h> |
| 26 #endif |
| 27 |
| 26 namespace content { | 28 namespace content { |
| 27 namespace { | 29 namespace { |
| 28 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 29 const base::FilePath::CharType | 31 const base::FilePath::CharType |
| 30 kTtyFilePath[] = FILE_PATH_LITERAL("/sys/class/tty/tty0/active"); | 32 kTtyFilePath[] = FILE_PATH_LITERAL("/sys/class/tty/tty0/active"); |
| 31 #endif | 33 #endif |
| 32 #if defined(USE_X11) | 34 #if defined(USE_X11) |
| 33 const unsigned char text[20] = "check"; | 35 const unsigned char text[20] = "check"; |
| 34 #endif | 36 #endif |
| 35 } // namespace | 37 } // namespace |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 kernel_time64.HighPart = kernel_time.dwHighDateTime; | 391 kernel_time64.HighPart = kernel_time.dwHighDateTime; |
| 390 kernel_time64.LowPart = kernel_time.dwLowDateTime; | 392 kernel_time64.LowPart = kernel_time.dwLowDateTime; |
| 391 | 393 |
| 392 // Time is reported in units of 100 nanoseconds. Kernel and user time are | 394 // Time is reported in units of 100 nanoseconds. Kernel and user time are |
| 393 // summed to deal with to kinds of hangs. One is where the GPU process is | 395 // summed to deal with to kinds of hangs. One is where the GPU process is |
| 394 // stuck in user level, never calling into the kernel and kernel time is | 396 // stuck in user level, never calling into the kernel and kernel time is |
| 395 // not increasing. The other is where either the kernel hangs and never | 397 // not increasing. The other is where either the kernel hangs and never |
| 396 // returns to user level or where user level code | 398 // returns to user level or where user level code |
| 397 // calls into kernel level repeatedly, giving up its quanta before it is | 399 // calls into kernel level repeatedly, giving up its quanta before it is |
| 398 // tracked, for example a loop that repeatedly Sleeps. | 400 // tracked, for example a loop that repeatedly Sleeps. |
| 399 return base::TimeDelta::FromMilliseconds(static_cast<int64>( | 401 return base::TimeDelta::FromMilliseconds(static_cast<int64_t>( |
| 400 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); | 402 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); |
| 401 } | 403 } |
| 402 #endif | 404 #endif |
| 403 | 405 |
| 404 } // namespace content | 406 } // namespace content |
| OLD | NEW |