Skip to content

Commit

Permalink
Disable spsc_queue in benchmarks when not running on x86 (issue camer…
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron314 committed Oct 10, 2017
1 parent ae14330 commit 973da17
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions benchmarks/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#define NO_FOLLY_SUPPORT
#endif

#if !defined(__amd64__) && !defined(_M_X64) && !defined(__x86_64__) && !defined(_M_IX86) && !defined(__i386__)
#define NO_SPSC_SUPPORT // SPSC implementation is for x86 only
#endif

#include "ext/1024cores/spscqueue.h" // Dmitry's (on Intel site)
#ifndef NO_FOLLY_SUPPORT
#include "ext/folly/ProducerConsumerQueue.h" // Facebook's folly (GitHub)
Expand Down Expand Up @@ -90,9 +94,16 @@ int main(int argc, char** argv)
for (int i = 0; i < TEST_COUNT; ++i) {
rwqResults[benchmark][i] = runBenchmark<ReaderWriterQueue<int>>((BenchmarkType)benchmark, randSeeds[benchmark], rwqOps[benchmark][i]);
}
#ifndef NO_SPSC_SUPPORT
for (int i = 0; i < TEST_COUNT; ++i) {
spscResults[benchmark][i] = runBenchmark<spsc_queue<int>>((BenchmarkType)benchmark, randSeeds[benchmark], spscOps[benchmark][i]);
}
#else
for (int i = 0; i < TEST_COUNT; ++i) {
spscResults[benchmark][i] = 0;
spscOps[benchmark][i] = 0;
}
#endif
#ifndef NO_FOLLY_SUPPORT
for (int i = 0; i < TEST_COUNT; ++i) {
follyResults[benchmark][i] = runBenchmark<ProducerConsumerQueue<int>>((BenchmarkType)benchmark, randSeeds[benchmark], follyOps[benchmark][i]);
Expand All @@ -115,6 +126,9 @@ int main(int argc, char** argv)
// Display results
int max = std::max(2, (int)(TEST_COUNT * FASTEST_PERCENT_CONSIDERED / 100));
assert(max > 0);
#ifdef NO_SPSC_SUPPORT
std::cout << "Note: SPSC queue not supported on this platform, discount its timings" << std::endl;
#endif
#ifdef NO_FOLLY_SUPPORT
std::cout << "Note: Folly queue not supported by this compiler, discount its timings" << std::endl;
#endif
Expand Down

0 comments on commit 973da17

Please sign in to comment.