Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test[MWC,MQB,BMQ]: Enable benchmark tests on Darwin #439

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <bmqeval_simpleevaluatorscanner.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -76,7 +76,7 @@ class MockPropertiesReader : public PropertiesReader {
}
};

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void testN1_SimpleEvaluator_GoogleBenchmark(benchmark::State& state)
{
mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: SimpleEvaluator");
Expand Down Expand Up @@ -502,7 +502,7 @@ int main(int argc, char* argv[])
} break;
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
8 changes: 4 additions & 4 deletions src/groups/bmq/bmqp/bmqp_compression.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <bsls_timeutil.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -964,7 +964,7 @@ static void testN3_performanceCompressionRatio()
}

// Begin Benchmarking Tests
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void testN1_performanceCompressionDecompressionDefault_GoogleBenchmark(
benchmark::State& state)
// ------------------------------------------------------------------------
Expand Down Expand Up @@ -1043,7 +1043,7 @@ static void testN2_calculateThroughput_GoogleBenchmark(benchmark::State& state)
}
// </time>
}
#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN
// ============================================================================
// MAIN PROGRAM
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1076,7 +1076,7 @@ int main(int argc, char* argv[])
s_testStatus = -1;
} break;
}
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
10 changes: 5 additions & 5 deletions src/groups/bmq/bmqp/bmqp_crc32c.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <bsls_timeutil.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -128,7 +128,7 @@ static int populateBufferLengthsSorted(bsl::vector<int>* bufferLengths)
return bufferLengths->back();
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
/// Populate the specified `bufferLengths` with various lengths in
/// increasing sorted order. Apply these arguments to Google Benchmark
/// internals Note that upper bound is 64 Ki
Expand Down Expand Up @@ -2174,7 +2174,7 @@ static void testN6_bdldPerformanceDefault()
s_allocator_p->deallocate(buffer);
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)

static void
testN1_performanceDefaultUserInput_GoogleBenchmark(benchmark::State& state)
Expand Down Expand Up @@ -2533,7 +2533,7 @@ testN6_bdldPerformanceDefault_GoogleBenchmark(benchmark::State& state)
s_allocator_p->deallocate(buffer);
}

#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN

// ============================================================================
// MAIN PROGRAM
Expand Down Expand Up @@ -2607,7 +2607,7 @@ int main(int argc, char* argv[])
s_testStatus = -1;
} break;
}
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
6 changes: 3 additions & 3 deletions src/groups/bmq/bmqp/bmqp_messageguidgenerator.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <mwctst_testhelper.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -1846,7 +1846,7 @@ static void testN10_hashCollisionsComparison()

// Begin Benchmarking Tests

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void testN1_decode_GoogleBenchmark(benchmark::State& state)
// ------------------------------------------------------------------------
// DECODE
Expand Down Expand Up @@ -2327,7 +2327,7 @@ int main(int argc, char* argv[])
s_testStatus = -1;
} break;
}
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
6 changes: 3 additions & 3 deletions src/groups/mqb/mqbs/mqbs_datastore.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <bsls_types.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -435,7 +435,7 @@ static void testN4_orderedMapWithCustomHashBenchmark()
<< " insertions per second.\n";
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void
testN1_defaultHashBenchmark_GoogleBenchmark(benchmark::State& state)
// ------------------------------------------------------------------------
Expand Down Expand Up @@ -594,7 +594,7 @@ int main(int argc, char* argv[])
s_testStatus = -1;
} break;
}
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
6 changes: 3 additions & 3 deletions src/groups/mqb/mqbu/mqbu_messageguidutil.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <mwctst_testhelper.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -928,7 +928,7 @@ BSLA_MAYBE_UNUSED static void testN8_orderedMapWithCustomHashBenchmark()
}

// Begin Benchmarking Library
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void testN1_decode_GoogleBenchmark(benchmark::State& state)
// ------------------------------------------------------------------------
// DECODE
Expand Down Expand Up @@ -1376,7 +1376,7 @@ int main(int argc, char* argv[])
s_testStatus = -1;
} break;
}
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
8 changes: 4 additions & 4 deletions src/groups/mqb/mqbu/mqbu_storagekey.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <bsls_types.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -711,7 +711,7 @@ void testN6_orderedMapWithCustomHashBenchmark()
}

// Begin Google Benchmark Tests
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void
testN1_defaultHashBenchmark_GoogleBenchmark(benchmark::State& state)
// ------------------------------------------------------------------------
Expand Down Expand Up @@ -929,7 +929,7 @@ static void testN6_orderedMapWithCustomHashBenchmark_GoogleBenchmark(
// </time>
}

#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN

} // close unnamed namespace

Expand Down Expand Up @@ -986,7 +986,7 @@ int main(int argc, char* argv[])
s_testStatus = -1;
} break;
}
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
if (_testCase < 0) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
Expand Down
12 changes: 6 additions & 6 deletions src/groups/mwc/mwcc/mwcc_array.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
// TEST DRIVER
#include <mwctst_testhelper.h>

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
// BENCHMARK
#include <benchmark/benchmark.h>
#include <chrono>
#include <cmath>
#include <iostream>
#include <vector>
#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN

// CONVENIENCE
using namespace BloombergLP;
Expand Down Expand Up @@ -851,7 +851,7 @@ static void test10_pushBackSelfRef()
}
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)

using namespace BloombergLP;

Expand Down Expand Up @@ -903,7 +903,7 @@ static void VectorAssign_GoogleBenchmark(benchmark::State& state)
}
}

#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN

// ============================================================================
// MAIN PROGRAM
Expand All @@ -924,7 +924,7 @@ int main(int argc, char* argv[])
case 3: test3_noMemoryAllocation(); break;
case 2: test2_outOfBoundValidation(); break;
case 1: test1_breathingTest(); break;
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
case -1:
benchmark::Initialize(&argc, argv);
BENCHMARK(VectorAssign_GoogleBenchmark)->Range(8, 4096);
Expand All @@ -936,7 +936,7 @@ int main(int argc, char* argv[])
BENCHMARK(VectorFindLarge_GoogleBenchmark)->Range(256, 8192);
benchmark::RunSpecifiedBenchmarks();
break;
#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN
default: {
cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl;
s_testStatus = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <mwctst_testhelper.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -549,7 +549,7 @@ static void testN1_MonitoredQueue_performance()
PRINT("s_antiOptimization = " << s_antiOptimization);
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void
testN1_MonitoredQueue_performance_GoogleBenchmark(benchmark::State& state)
// ------------------------------------------------------------------------
Expand Down Expand Up @@ -801,7 +801,7 @@ static void testN1_bdlccFixedQueueThreaded_performance_GoogleBenchmark(
}
}
}
#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN

//=============================================================================
// MAIN PROGRAM
Expand All @@ -816,7 +816,7 @@ int main(int argc, char* argv[])
case 2: test2_MonitoredQueue_reset(); break;
case 1: test1_MonitoredQueue_breathingTest(); break;
case -1:
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
BENCHMARK(testN1_MonitoredQueue_performance_GoogleBenchmark)
->Unit(benchmark::kMillisecond);
BENCHMARK(testN1_MonitoredQueueThreaded_performance_GoogleBenchmark)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <mwctst_testhelper.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -537,7 +537,7 @@ static void testN1_MonitoredSingleConsumerQueue_performance()
}

// Begin Benchmark Tests
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void testN1_MonitoredSingleConsumerQueue_performance_GoogleBenchmark(
benchmark::State& state)
// ------------------------------------------------------------------------
Expand Down Expand Up @@ -796,7 +796,7 @@ testN1_bdlccSingleConsumerQueueThreaded_performance_GoogleBenchmark(
}
}

#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN

//=============================================================================
// MAIN PROGRAM
Expand All @@ -811,7 +811,7 @@ int main(int argc, char* argv[])
case 2: test2_MonitoredSingleConsumerQueue_exceed_reset(); break;
case 1: test1_MonitoredSingleConsumerQueue_breathingTest(); break;
case -1:
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
BENCHMARK(
testN1_MonitoredSingleConsumerQueue_performance_GoogleBenchmark)
->Unit(benchmark::kMillisecond);
Expand Down
8 changes: 4 additions & 4 deletions src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <mwctst_testhelper.h>

// BENCHMARKING LIBRARY
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
#include <benchmark/benchmark.h>
#endif

Expand Down Expand Up @@ -373,7 +373,7 @@ static void testN1_performance()
printProcessedItems(k_NUM_ITERATIONS, endTime - startTime);
}

#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
static void testN1_performance_GoogleBenchmark(benchmark::State& state)
// ------------------------------------------------------------------------
// PERFORMANCE TEST
Expand Down Expand Up @@ -503,7 +503,7 @@ static void testN1_fixedPerformance_GoogleBenchmark(benchmark::State& state)
}
}
}
#endif // BSLS_PLATFORM_OS_LINUX
#endif // BSLS_PLATFORM_OS_LINUX || BSLS_PLATFORM_OS_DARWIN
//=============================================================================
// MAIN PROGRAM
//-----------------------------------------------------------------------------
Expand All @@ -516,7 +516,7 @@ int main(int argc, char* argv[])
case 0:
case 1: test1_breathingTest(); break;
case -1:
#ifdef BSLS_PLATFORM_OS_LINUX
#if defined(BSLS_PLATFORM_OS_LINUX) || defined(BSLS_PLATFORM_OS_DARWIN)
BENCHMARK(testN1_fixedPerformance_GoogleBenchmark)
->Unit(benchmark::kMillisecond);
BENCHMARK(testN1_performance_GoogleBenchmark)
Expand Down
Loading
Loading