test: Use rdtsc when available
authorDavid Schleef <ds@schleef.org>
Thu, 10 Jun 2010 01:27:16 +0000 (18:27 -0700)
committerDavid Schleef <ds@schleef.org>
Thu, 10 Jun 2010 01:27:16 +0000 (18:27 -0700)
orc-test/orcprofile.c

index 4141957..48e0c3e 100644 (file)
@@ -152,10 +152,16 @@ orc_profile_get_ave_std (OrcProfile *prof, double *ave_p, double *std_p)
 static unsigned long
 oil_profile_stamp_default (void)
 {
-#ifdef notused
+#if defined(__GNUC__) && (defined(HAVE_I386) || defined(HAVE_AMD64))
   unsigned long ts;
   __asm__ __volatile__("rdtsc\n" : "=a" (ts) : : "edx");
   return ts;
+#elif defined(_MSC_VER) && defined(HAVE_I386)
+  unsigned long ts;
+  __asm push edx
+  __asm __emit 0fh __asm __emit 031h
+  __asm mov ts, eax
+  __asm pop edx
 #elif defined(HAVE_CLOCK_GETTIME) && defined(HAVE_MONOTONIC_CLOCK)
   struct timespec ts;
   clock_gettime (CLOCK_MONOTONIC, &ts);