Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1170)

Unified Diff: base/time/time_win.cc

Issue 1910063003: More accurate implementation of watched thread time for Gpu Watchdog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/time/time_win.cc
diff --git a/base/time/time_win.cc b/base/time/time_win.cc
index ad3c9914dbdc81cceff83b4698f43252a480ba8b..59e5997123d9e3b41604800c013b779818df010a 100644
--- a/base/time/time_win.cc
+++ b/base/time/time_win.cc
@@ -42,6 +42,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
using base::ThreadTicks;
using base::Time;
@@ -518,11 +519,17 @@ TimeTicks::Clock TimeTicks::GetClock() {
// static
ThreadTicks ThreadTicks::Now() {
+ return ThreadTicks::Now(PlatformThread::CurrentHandle());
+}
+
+// static
+ThreadTicks ThreadTicks::Now(const base::PlatformThreadHandle& thread_handle) {
DCHECK(IsSupported());
// Get the number of TSC ticks used by the current thread.
ULONG64 thread_cycle_time = 0;
- GetQueryThreadCycleTimeFunction()(::GetCurrentThread(), &thread_cycle_time);
+ GetQueryThreadCycleTimeFunction()(thread_handle.platform_handle(),
fdoray 2016/04/21 21:08:37 We can call ::QueryThreadCycleTime() directly and
stanisc 2016/04/22 01:11:45 OK, I've removed GetQueryThreadCycleTimeFunction()
+ &thread_cycle_time);
// Get the frequency of the TSC.
double tsc_ticks_per_second = TSCTicksPerSecond();

Powered by Google App Engine
This is Rietveld 408576698