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

Side by Side Diff: base/time_win_unittest.cc

Issue 9836125: Fix base::CPU detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix TimeTicks.Drift test Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/cpu_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <windows.h> 5 #include <windows.h>
6 #include <mmsystem.h> 6 #include <mmsystem.h>
7 #include <process.h> 7 #include <process.h>
8 8
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // monotonically, making our measurement less realistic. 222 // monotonically, making our measurement less realistic.
223 base::PlatformThread::Sleep( 223 base::PlatformThread::Sleep(
224 base::TimeDelta::FromMilliseconds((i % 2 == 0) ? 1 : 2)); 224 base::TimeDelta::FromMilliseconds((i % 2 == 0) ? 1 : 2));
225 225
226 total_drift += drift_microseconds; 226 total_drift += drift_microseconds;
227 } 227 }
228 228
229 // Sanity check. We expect some time drift to occur, especially across 229 // Sanity check. We expect some time drift to occur, especially across
230 // the number of iterations we do. However, if the QPC is disabled, this 230 // the number of iterations we do. However, if the QPC is disabled, this
231 // is not measuring anything (drift is zero in that case). 231 // is not measuring anything (drift is zero in that case).
232 EXPECT_LT(0, total_drift); 232 if (TimeTicks::IsHighResClockWorking())
233 EXPECT_LT(0, total_drift);
jar (doing other things) 2012/03/28 18:46:56 This seems like a high-risk flaky test. In additi
233 234
234 printf("average time drift in microseconds: %lld\n", 235 printf("average time drift in microseconds: %lld\n",
235 total_drift / kIterations); 236 total_drift / kIterations);
236 } 237 }
OLDNEW
« no previous file with comments | « base/cpu_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698