Rename GetTickCount to GetClockTickCount
authorChristopher Dykes <cdykes@fb.com>
Fri, 22 Jul 2016 17:16:18 +0000 (10:16 -0700)
committerFacebook Github Bot 1 <facebook-github-bot-1-bot@fb.com>
Fri, 22 Jul 2016 17:23:51 +0000 (10:23 -0700)
Summary: Because Windows already defines a funtion named `GetTickCount` with a different signature.

Reviewed By: yfeldblum

Differential Revision: D3601877

fbshipit-source-id: fa0fb422156a3dc71e149e02a000ccdf3479eea5

folly/test/SpookyHashV1Test.cpp
folly/test/SpookyHashV2Test.cpp

index 47920a608094734de2a991ff206bbb66040a67db..9748a759c33ad99e6a05afd7c6f436dd848255de 100644 (file)
@@ -36,7 +36,7 @@ using namespace ::folly::hash;
 
 static bool failed = false;
 
-static uint64_t GetTickCount() {
+static uint64_t GetClockTickCount() {
   timespec ts;
   clock_gettime(CLOCK_REALTIME, &ts);
   return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;  // milliseconds
@@ -273,41 +273,41 @@ void DoTimingBig(int seed)
         memset(buf[i], (char)seed, BUFSIZE);
     }
 
-    uint64_t a = GetTickCount();
+    uint64_t a = GetClockTickCount();
     uint64_t hash1 = seed;
     uint64_t hash2 = seed;
     for (uint64_t i=0; i<NUMBUF; ++i)
     {
         SpookyHashV1::Hash128(buf[i], BUFSIZE, &hash1, &hash2);
     }
-    uint64_t z = GetTickCount();
+    uint64_t z = GetClockTickCount();
     printf("SpookyHashV1::Hash128, uncached: time is "
            "%4" PRIu64 " milliseconds\n", z-a);
 
-    a = GetTickCount();
+    a = GetClockTickCount();
     for (uint64_t i=0; i<NUMBUF; ++i)
     {
         Add(buf[i], BUFSIZE, &hash1, &hash2);
     }
-    z = GetTickCount();
+    z = GetClockTickCount();
     printf("Addition           , uncached: time is "
            "%4" PRIu64 " milliseconds\n", z-a);
 
-    a = GetTickCount();
+    a = GetClockTickCount();
     for (uint64_t i=0; i<NUMBUF*BUFSIZE/1024; ++i)
     {
         SpookyHashV1::Hash128(buf[0], 1024, &hash1, &hash2);
     }
-    z = GetTickCount();
+    z = GetClockTickCount();
     printf("SpookyHashV1::Hash128,   cached: time is "
            "%4" PRIu64 " milliseconds\n", z-a);
 
-    a = GetTickCount();
+    a = GetClockTickCount();
     for (uint64_t i=0; i<NUMBUF*BUFSIZE/1024; ++i)
     {
         Add(buf[0], 1024, &hash1, &hash2);
     }
-    z = GetTickCount();
+    z = GetClockTickCount();
     printf("Addition           ,   cached: time is "
            "%4" PRIu64 " milliseconds\n", z-a);
 
@@ -336,14 +336,14 @@ void DoTimingSmall(int seed)
 
     for (int i=1; i <= BUFSIZE; i <<= 1)
     {
-        uint64_t a = GetTickCount();
+        uint64_t a = GetClockTickCount();
         uint64_t hash1 = seed;
         uint64_t hash2 = seed+i;
         for (int j=0; j<NUMITER; ++j)
         {
             SpookyHashV1::Hash128((char *)buf, i, &hash1, &hash2);
         }
-        uint64_t z = GetTickCount();
+        uint64_t z = GetClockTickCount();
         printf("%d bytes: hash is %.16" PRIx64 " %.16" PRIx64 ", "
                "time is %" PRIu64 "\n", i, hash1, hash2, z-a);
     }
index c370c9e67c884d482196813eea7b2f8bf0e8de37..65503baae5cf14aa445e6e4b7b76e4bb9b6249b9 100644 (file)
@@ -36,7 +36,7 @@ using namespace ::folly::hash;
 
 static bool failed = false;
 
-static uint64_t GetTickCount() {
+static uint64_t GetClockTickCount() {
   timespec ts;
   clock_gettime(CLOCK_REALTIME, &ts);
   return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;  // milliseconds
@@ -263,41 +263,41 @@ void DoTimingBig(int seed)
         memset(buf[i], (char)seed, BUFSIZE);
     }
 
-    uint64_t a = GetTickCount();
+    uint64_t a = GetClockTickCount();
     uint64_t hash1 = seed;
     uint64_t hash2 = seed;
     for (uint64_t i=0; i<NUMBUF; ++i)
     {
         SpookyHashV2::Hash128(buf[i], BUFSIZE, &hash1, &hash2);
     }
-    uint64_t z = GetTickCount();
+    uint64_t z = GetClockTickCount();
     printf("SpookyHashV2::Hash128, uncached: time is "
            "%4" PRId64 " milliseconds\n", z-a);
 
-    a = GetTickCount();
+    a = GetClockTickCount();
     for (uint64_t i=0; i<NUMBUF; ++i)
     {
         Add(buf[i], BUFSIZE, &hash1, &hash2);
     }
-    z = GetTickCount();
+    z = GetClockTickCount();
     printf("Addition           , uncached: time is %4" PRId64 " milliseconds\n",
            z-a);
 
-    a = GetTickCount();
+    a = GetClockTickCount();
     for (uint64_t i=0; i<NUMBUF*BUFSIZE/1024; ++i)
     {
         SpookyHashV2::Hash128(buf[0], 1024, &hash1, &hash2);
     }
-    z = GetTickCount();
+    z = GetClockTickCount();
     printf("SpookyHashV2::Hash128,   cached: time is "
            "%4" PRId64 " milliseconds\n", z-a);
 
-    a = GetTickCount();
+    a = GetClockTickCount();
     for (uint64_t i=0; i<NUMBUF*BUFSIZE/1024; ++i)
     {
         Add(buf[0], 1024, &hash1, &hash2);
     }
-    z = GetTickCount();
+    z = GetClockTickCount();
     printf("Addition           ,   cached: time is %4" PRId64 " milliseconds\n",
            z-a);
 
@@ -326,14 +326,14 @@ void DoTimingSmall(int seed)
 
     for (int i=1; i <= BUFSIZE; i <<= 1)
     {
-        uint64_t a = GetTickCount();
+        uint64_t a = GetClockTickCount();
         uint64_t hash1 = seed;
         uint64_t hash2 = seed+i;
         for (int j=0; j<NUMITER; ++j)
         {
             SpookyHashV2::Hash128((char *)buf, i, &hash1, &hash2);
         }
-        uint64_t z = GetTickCount();
+        uint64_t z = GetClockTickCount();
         printf("%d bytes: hash is %.16" PRIx64 " %.16" PRIx64 ", "
                "time is %" PRId64 "\n", i, hash1, hash2, z-a);
     }