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

Unified Diff: base/time_win_unittest.cc

Issue 12045074: test of other windows timing functions Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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_win_unittest.cc
diff --git a/base/time_win_unittest.cc b/base/time_win_unittest.cc
index 7ac36629e6808cce34550539d0b5fa72d83dc8ab..c362e03fce650ae30444c677ea4e0376bad5a924 100644
--- a/base/time_win_unittest.cc
+++ b/base/time_win_unittest.cc
@@ -163,10 +163,28 @@ TEST(TimeTicks, QueryPerformanceFrequency) {
frequency.QuadPart / 1000000.0);
}
+TimeTicks GetTickCountTest() {
+ return TimeTicks::FromInternalValue(GetTickCount64());
+}
+
+TimeTicks RDTSCTest() {
+ return TimeTicks::FromInternalValue(__rdtsc());
+}
+
+TimeTicks TimeGetTimeTest() {
+ return TimeTicks::FromInternalValue(timeGetTime());
+}
+
+TimeTicks QPCTest() {
+ LARGE_INTEGER out;
+ QueryPerformanceCounter(&out);
+ return TimeTicks::FromInternalValue(out.QuadPart);
+}
+
TEST(TimeTicks, TimerPerformance) {
// Verify that various timer mechanisms can always complete quickly.
// Note: This is a somewhat arbitrary test.
- const int kLoops = 10000;
+ const int kLoops = 10000000;
// Due to the fact that these run on bbots, which are horribly slow,
// we can't really make any guarantees about minimum runtime.
// Really, we want these to finish in ~10ms, and that is generous.
@@ -183,6 +201,10 @@ TEST(TimeTicks, TimerPerformance) {
test_only_works_with_same_sizes);
TestCase cases[] = {
{ reinterpret_cast<TestFunc>(Time::Now), "Time::Now" },
+ { GetTickCountTest, "GetTickCount64" },
+ { RDTSCTest, "__rdtsc" },
+ { TimeGetTimeTest, "timeGetTime" },
+ { QPCTest, "QueryPerformanceCounter" },
{ TimeTicks::Now, "TimeTicks::Now" },
{ TimeTicks::HighResNow, "TimeTicks::HighResNow" },
{ NULL, "" }
« 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