]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/perf_local: disable tests if not supported 4820/head
authorKefu Chai <kchai@redhat.com>
Mon, 1 Jun 2015 03:16:01 +0000 (11:16 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 1 Jun 2015 06:58:57 +0000 (14:58 +0800)
* pass appropriate "-m<machine>" args to compiler

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/Makefile-server.am
src/test/perf_local.cc

index 2d5964ef3c09a7d2e1b914c406b6ad049268e43c..6ced749e34d98c2d4fdf43ddd069fb294bb6b840 100644 (file)
@@ -32,6 +32,10 @@ bin_DEBUGPROGRAMS += ceph_perf_objectstore
 
 ceph_perf_local_SOURCES = test/perf_local.cc test/perf_helper.cc
 ceph_perf_local_LDADD = $(LIBOS) $(CEPH_GLOBAL)
+ceph_perf_local_CXXFLAGS = ${AM_CXXFLAGS}      \
+       ${INTEL_SSE_FLAGS} \
+       ${INTEL_SSE2_FLAGS}
+
 noinst_HEADERS += test/perf_helper.h
 bin_DEBUGPROGRAMS += ceph_perf_local
 
index f388f6102055d79dc58c8e4718c306342dd6231b..ba3bc0fa086deade6ae1cc8783095726f8266950 100644 (file)
@@ -35,7 +35,9 @@
 // * Create a new entry for the test in the #tests table.
 #include <vector>
 #include <sched.h>
-#if defined(__x86_64__) || defined(__amd64__)
+
+#include "acconfig.h"
+#ifdef HAVE_SSE
 #include <xmmintrin.h>
 #endif
 
@@ -600,7 +602,7 @@ double perf_cycles_to_nanoseconds()
 }
 
 
-#if defined(__x86_64__) || defined(__amd64__)
+#ifdef HAVE_SSE
 /**
  * Prefetch the cache lines containing [object, object + numBytes) into the
  * processor's caches.
@@ -613,19 +615,17 @@ double perf_cycles_to_nanoseconds()
  */
 static inline void prefetch(const void *object, uint64_t num_bytes)
 {
-#if defined(__x86_64__) || defined(__amd64__)
     uint64_t offset = reinterpret_cast<uint64_t>(object) & 0x3fUL;
     const char* p = reinterpret_cast<const char*>(object) - offset;
     for (uint64_t i = 0; i < offset + num_bytes; i += 64)
         _mm_prefetch(p + i, _MM_HINT_T0);
-#endif
 }
 #endif
 
 // Measure the cost of the prefetch instruction.
 double perf_prefetch()
 {
-#if defined(__x86_64__) || defined(__amd64__)
+#ifdef HAVE_SSE
   uint64_t total_ticks = 0;
   int count = 10;
   char buf[16 * 64];
@@ -689,6 +689,7 @@ double perf_serialize() {
 // Measure the cost of an lfence instruction.
 double lfence()
 {
+#ifdef HAVE_SSE2
   int count = 1000000;
   uint64_t start = Cycles::rdtsc();
   for (int i = 0; i < count; i++) {
@@ -696,11 +697,15 @@ double lfence()
   }
   uint64_t stop = Cycles::rdtsc();
   return Cycles::to_seconds(stop - start)/count;
+#else
+  return -1;
+#endif
 }
 
 // Measure the cost of an sfence instruction.
 double sfence()
 {
+#ifdef HAVE_SSE
   int count = 1000000;
   uint64_t start = Cycles::rdtsc();
   for (int i = 0; i < count; i++) {
@@ -708,6 +713,9 @@ double sfence()
   }
   uint64_t stop = Cycles::rdtsc();
   return Cycles::to_seconds(stop - start)/count;
+#else
+  return -1;
+#endif
 }
 
 // Measure the cost of acquiring and releasing a SpinLock (assuming the