[ofa-general] [PATCH] v2 dapltest - RHEL5.1 ia64 build problems, convert timestamps to gettimeofday
Davis, Arlin R
arlin.r.davis at intel.com
Fri Nov 16 13:50:51 PST 2007
Fix RHEL5.1 ia64 v2 dapltest build problems with get_cycles by moving to gettimeofday.
James, I kept the get_cycle code in with compile-time switch (RDTSC_TIMERS) and fixed the ia64 build issue just in case some cannot live without it. If you think we should just blow it all away let me know and I will update the patch.
- Change dapltest timing to use gettimeofday instead of get_cycles for better portability.
Signed-off by: Arlin Davis <ardavis at ichips.intel.com>
diff --git a/test/dapltest/mdep/linux/dapl_mdep_user.c b/test/dapltest/mdep/linux/dapl_mdep_user.c
index 015e53c..6402623 100644
--- a/test/dapltest/mdep/linux/dapl_mdep_user.c
+++ b/test/dapltest/mdep/linux/dapl_mdep_user.c
@@ -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
diff --git a/test/dapltest/mdep/linux/dapl_mdep_user.h b/test/dapltest/mdep/linux/dapl_mdep_user.h
index 4aa25d3..153c8c1 100755
--- a/test/dapltest/mdep/linux/dapl_mdep_user.h
+++ b/test/dapltest/mdep/linux/dapl_mdep_user.h
@@ -43,10 +43,6 @@
#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
diff --git a/test/dapltest/test/dapl_performance_stats.c b/test/dapltest/test/dapl_performance_stats.c
index ce29272..0b1eaf1 100644
--- a/test/dapltest/test/dapl_performance_stats.c
+++ b/test/dapltest/test/dapl_performance_stats.c
@@ -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),
More information about the general
mailing list