diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 03:00:00 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 03:00:00 +0000 |
commit | de592d31b3e82b1ff938c46f3db8cb06a716062e (patch) | |
tree | 32af531b478fabff890ca7b7dee71ffccf744048 /base/time.h | |
parent | f5e3da4d564980a048f375cf1a824a01df03382a (diff) | |
download | chromium_src-de592d31b3e82b1ff938c46f3db8cb06a716062e.zip chromium_src-de592d31b3e82b1ff938c46f3db8cb06a716062e.tar.gz chromium_src-de592d31b3e82b1ff938c46f3db8cb06a716062e.tar.bz2 |
Change to Hi Res timers on Windows.
There are two parts of this:
1) TimeTicks:Now()
Don't call timeBeginPeriod() in all cases.
Use the new SystemMonitor class to watch battery on/off
transitions and use the timeBeginPeriod() only when we're
using the battery.
2) TimeTicks::UnreliableHiResNow()
Change this function from "UnreliableHiResNow()" to
"HiResNow()". We still use QPC, but we detect if we're
on AMD Athlon XP machines which fail on QPC. For those
systems, we fall back to TimeTicks::Now().
Updated tests to detect hardware specifics of timers.
Output of the test will contain lines such as these:
[ RUN ] TimeTicks.SubMillisecondTimers
Min timer is: 1us
[ OK ] TimeTicks.SubMillisecondTimers
[ RUN ] TimeTicks.TimeGetTimeCaps
timeGetTime range is 1 to 1000000ms
[ OK ] TimeTicks.TimeGetTimeCaps
[ RUN ] TimeTicks.QueryPerformanceFrequency
QueryPerformanceFrequency is 2394.18MHz
[ OK ] TimeTicks.QueryPerformanceFrequency
[ RUN ] TimeTicks.TimerPerformance
Time::Now: 0.11us per call
TimeTicks::Now: 0.09us per call
TimeTicks::HighResNow: 0.26us per call
[ OK ] TimeTicks.TimerPerformance
Review URL: http://codereview.chromium.org/4092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time.h')
-rw-r--r-- | base/time.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/base/time.h b/base/time.h index addb246..4141116 100644 --- a/base/time.h +++ b/base/time.h @@ -348,15 +348,15 @@ class TimeTicks { } // Platform-dependent tick count representing "right now." - // The resolution of this clock is ~1-5ms. Resolution varies depending + // The resolution of this clock is ~1-15ms. Resolution varies depending // on hardware/operating system configuration. static TimeTicks Now(); - // Returns a platform-dependent high-resolution tick count. IT IS BROKEN ON - // SOME HARDWARE and is designed to be used for profiling and perf testing - // only (see the impl for more information). - static TimeTicks UnreliableHighResNow(); - + // Returns a platform-dependent high-resolution tick count. Implementation + // is hardware dependent and may or may not return sub-millisecond + // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND + // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. + static TimeTicks HighResNow(); // Returns true if this object has not been initialized. bool is_null() const { |