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

Unified Diff: base/time/time_win.cc

Issue 1284053004: Makes TraceTicks use lowres times on Win when highres are buggy or slow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time_win.cc
diff --git a/base/time/time_win.cc b/base/time/time_win.cc
index e9044603e9aedf7a7841d6f2e8406ad68289f291..1897b04995bb9cb916860b4db67ea29f35db5940 100644
--- a/base/time/time_win.cc
+++ b/base/time/time_win.cc
@@ -436,22 +436,19 @@ void InitializeNowFunctionPointers() {
// TraceTicks::Now() must use the low-resolution clock.
//
// If the QPC implementation is expensive and/or unreliable, TimeTicks::Now()
- // will use the low-resolution clock, but TraceTicks::Now() will use the QPC
- // (in the hope that it is still useful for tracing purposes). A CPU lacking a
- // non-stop time counter will cause Windows to provide an alternate QPC
- // implementation that works, but is expensive to use. Certain Athlon CPUs are
- // known to make the QPC implementation unreliable.
+ // and TraceTicks::Now() will still use the low-resolution clock. A CPU
+ // lacking a non-stop time counter will cause Windows to provide an alternate
+ // QPC implementation that works, but is expensive to use. Certain Athlon CPUs
+ // are known to make the QPC implementation unreliable.
//
// Otherwise, both Now functions can use the high-resolution QPC clock. As of
- // 4 January 2015, ~68% of users fall within this category.
+ // 21 August 2015, ~72% of users fall within this category.
NowFunction now_function;
NowFunction system_trace_now_function;
base::CPU cpu;
- if (ticks_per_sec.QuadPart <= 0) {
+ if (ticks_per_sec.QuadPart <= 0 ||
+ !cpu.has_non_stop_time_stamp_counter() || IsBuggyAthlon(cpu)) {
now_function = system_trace_now_function = &RolloverProtectedNow;
fmeawad 2015/08/21 21:24:40 Can you explain why you still need 2 variable (now
- } else if (!cpu.has_non_stop_time_stamp_counter() || IsBuggyAthlon(cpu)) {
- now_function = &RolloverProtectedNow;
- system_trace_now_function = &QPCNow;
} else {
now_function = system_trace_now_function = &QPCNow;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698