]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Change dapltest timers to use gettimeofday instead of get_cycles for better portability.
authorArlin Davis <arlin.r.davis@intel.com>
Mon, 19 Nov 2007 23:26:44 +0000 (15:26 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Mon, 19 Nov 2007 23:26:44 +0000 (15:26 -0800)
Signed-off by: Arlin Davis <ardavis@ichips.intel.com>

test/dapltest/mdep/linux/dapl_mdep_user.c
test/dapltest/mdep/linux/dapl_mdep_user.h
test/dapltest/test/dapl_performance_stats.c

index 015e53ca2d60f6994941158a1c400267a4cfbdf2..6402623c3e4535a379225c04a8c8d459b9f80fcf 100644 (file)
@@ -181,6 +181,7 @@ DT_Mdep_GetTime (void)
     return tv.tv_sec * 1000 + tv.tv_usec / 1000;
 }
 
+#ifdef RDTSC_TIMERS
 double
 DT_Mdep_GetCpuMhz (
     void )
@@ -231,6 +232,15 @@ DT_Mdep_GetCpuMhz (
 
     return strtod (mhz_str, NULL) / DT_TSC_BASE;
 }
+#else /* !RDTSC_TIMERS */
+
+double
+DT_Mdep_GetCpuMhz (
+    void )
+{
+    return 1;
+}
+#endif
 
 
 unsigned long
index 4aa25d38f30950f8f5422ab3afff48f528c621ab..153c8c1468632212d3f32468b75bed8a37414d41 100755 (executable)
 #include <string.h>
 #include <sys/times.h>
 
-#ifdef __ia64__
-#include <asm/timex.h>
-#endif
-
 /* Default Device Name */
 #define DT_MdepDeviceName    "ofa-v2-ib0"
 
@@ -111,7 +107,7 @@ typedef struct
 /*
  * Timing
  */
-
+#ifdef RDTSC_TIMERS
 typedef unsigned long long int                 DT_Mdep_TimeStamp;
 
 static _INLINE_ DT_Mdep_TimeStamp
@@ -122,12 +118,10 @@ DT_Mdep_GetTimeStamp ( void )
     __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
     return x;
 #else
-
 #ifdef __ia64__
-    unsigned long x;
-
-    x = get_cycles ();
-    return x;
+    unsigned long ret;
+    __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret));
+    return ret;
 #else
 #if defined(__PPC__) || defined(__PPC64__)
     unsigned int tbl, tbu0, tbu1;
@@ -149,6 +143,21 @@ DT_Mdep_GetTimeStamp ( void )
 #endif
 #endif
 }
+#else /* !RDTSC_TIMERS */
+/* 
+ * Get timestamp, microseconds, (relative to some fixed point)
+ */
+typedef double DT_Mdep_TimeStamp;
+
+static _INLINE_ DT_Mdep_TimeStamp
+DT_Mdep_GetTimeStamp ( void )
+{
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return (tv.tv_sec * 1000000 + tv.tv_usec);
+}
+#endif
+
 
 /*
  * Define long format types to be used in *printf format strings.  We
index ce292722fccfe86f8c31bef0c1d089f82da7034a..0b1eaf17773e5038c93e6960e8252714d87c94e1 100644 (file)
@@ -281,7 +281,7 @@ DT_performance_stats_print (
                   "    Operation Type       : %s\n"
                   "    Number of Operations : %u\n"
                   "    Segment Size         : %u\n"
-                  "    Number of Segments   : %u bytes\n"
+                  "    Number of Segments   : %u \n"
                   "    Pipeline Length      : %u\n\n",
                   DT_PerformanceModeToString (cmd->mode),
                   DT_TransferTypeToString (cmd->op.transfer_type),