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

Side by Side Diff: base/time/time_win.cc

Issue 2090783002: Limit InterProcessTimeTicksConverter to platforms that require it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comment fix Created 4 years, 5 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
« no previous file with comments | « base/time/time_posix.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | 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) 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 5
6 // Windows Timer Primer 6 // Windows Timer Primer
7 // 7 //
8 // A good article: http://www.ddj.com/windows/184416651 8 // A good article: http://www.ddj.com/windows/184416651
9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258 9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258
10 // 10 //
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 497 }
498 498
499 // static 499 // static
500 bool TimeTicks::IsHighResolution() { 500 bool TimeTicks::IsHighResolution() {
501 if (g_now_function == &InitialNowFunction) 501 if (g_now_function == &InitialNowFunction)
502 InitializeNowFunctionPointer(); 502 InitializeNowFunctionPointer();
503 return g_now_function == &QPCNow; 503 return g_now_function == &QPCNow;
504 } 504 }
505 505
506 // static 506 // static
507 bool TimeTicks::IsConsistentAcrossProcesses() {
508 // According to Windows documentation [1] QPC is consistent post-Windows
509 // Vista. So if we are using QPC then we are consistent which is the same as
510 // being high resolution.
511 //
512 // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs. 85).aspx
513 //
514 // "In general, the performance counter results are consistent across all
515 // processors in multi-core and multi-processor systems, even when measured on
516 // different threads or processes. Here are some exceptions to this rule:
517 // - Pre-Windows Vista operating systems that run on certain processors might
518 // violate this consistency because of one of these reasons:
519 // 1. The hardware processors have a non-invariant TSC and the BIOS
520 // doesn't indicate this condition correctly.
521 // 2. The TSC synchronization algorithm that was used wasn't suitable for
522 // systems with large numbers of processors."
523 return IsHighResolution();
524 }
525
526 // static
507 TimeTicks::Clock TimeTicks::GetClock() { 527 TimeTicks::Clock TimeTicks::GetClock() {
508 return IsHighResolution() ? 528 return IsHighResolution() ?
509 Clock::WIN_QPC : Clock::WIN_ROLLOVER_PROTECTED_TIME_GET_TIME; 529 Clock::WIN_QPC : Clock::WIN_ROLLOVER_PROTECTED_TIME_GET_TIME;
510 } 530 }
511 531
512 // static 532 // static
513 ThreadTicks ThreadTicks::Now() { 533 ThreadTicks ThreadTicks::Now() {
514 return ThreadTicks::GetForThread(PlatformThread::CurrentHandle()); 534 return ThreadTicks::GetForThread(PlatformThread::CurrentHandle());
515 } 535 }
516 536
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) { 630 TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) {
611 return TimeTicks() + QPCValueToTimeDelta(qpc_value); 631 return TimeTicks() + QPCValueToTimeDelta(qpc_value);
612 } 632 }
613 633
614 // TimeDelta ------------------------------------------------------------------ 634 // TimeDelta ------------------------------------------------------------------
615 635
616 // static 636 // static
617 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) { 637 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) {
618 return QPCValueToTimeDelta(qpc_value); 638 return QPCValueToTimeDelta(qpc_value);
619 } 639 }
OLDNEW
« no previous file with comments | « base/time/time_posix.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698