|
26 | 26 | #include "lockbasedqueue.h" |
27 | 27 | #include "simplelockfree.h" |
28 | 28 | #include "boostqueue.h" |
| 29 | + |
| 30 | +#pragma clang diagnostic push |
| 31 | +#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 32 | +// this uses an old version of OS memory fences on OSX |
29 | 33 | #include "tbbqueue.h" |
| 34 | +#pragma clang diagnostic pop |
| 35 | + |
30 | 36 | #include "stdqueue.h" |
31 | 37 | #include "dlibqueue.h" |
32 | 38 | #include "../tests/common/simplethread.h" |
@@ -966,7 +972,6 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
966 | 972 |
|
967 | 973 | case bench_only_enqueue_bulk: { |
968 | 974 | TQueue q; |
969 | | - item_t item = 1; |
970 | 975 | item_t item_rec; |
971 | 976 | std::vector<counter_t> data; |
972 | 977 | for (counter_t i = 0; i != BULK_BATCH_SIZE; ++i) { |
@@ -1027,7 +1032,6 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
1027 | 1032 | case bench_mostly_enqueue_bulk: { |
1028 | 1033 | // Measures the average speed of enqueueing in bulk under light contention |
1029 | 1034 | TQueue q; |
1030 | | - item_t item = 1; |
1031 | 1035 | item_t item_rec; |
1032 | 1036 | std::vector<counter_t> data; |
1033 | 1037 | for (counter_t i = 0; i != BULK_BATCH_SIZE; ++i) { |
@@ -1103,7 +1107,6 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
1103 | 1107 | case bench_only_dequeue_bulk: { |
1104 | 1108 | // Measures the average speed of dequeueing in bulk when all threads are consumers |
1105 | 1109 | TQueue q; |
1106 | | - item_t item = 1; |
1107 | 1110 | item_t item_rec; |
1108 | 1111 | { |
1109 | 1112 | // Fill up the queue first |
@@ -1194,7 +1197,6 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
1194 | 1197 | case bench_mostly_dequeue_bulk: { |
1195 | 1198 | // Measures the average speed of dequeueing in bulk under light contention |
1196 | 1199 | TQueue q; |
1197 | | - item_t item = 1; |
1198 | 1200 | item_t item_rec; |
1199 | 1201 | auto enqueueThreads = std::max(1, nthreads / 4); |
1200 | 1202 | out_opCount = maxOps * BULK_BATCH_SIZE * enqueueThreads; |
@@ -1505,11 +1507,10 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
1505 | 1507 | // (that eight separate threads had at one point enqueued to) |
1506 | 1508 | out_opCount = maxOps * 2 * nthreads; |
1507 | 1509 | TQueue q; |
1508 | | - item_t item = 1; |
1509 | 1510 | item_t item_rec; |
1510 | 1511 | if (nthreads == 1) { |
1511 | 1512 | // No contention -- measures speed of immediately dequeueing the item that was just enqueued |
1512 | | - int item; |
| 1513 | + int item = 0; |
1513 | 1514 | auto start = getSystemTime(); |
1514 | 1515 | if (useTokens) { |
1515 | 1516 | typename TQueue::producer_token_t prodTok(q); |
@@ -1538,7 +1539,7 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
1538 | 1539 | while (ready.load(std::memory_order_relaxed) != nthreads) |
1539 | 1540 | continue; |
1540 | 1541 |
|
1541 | | - int item; |
| 1542 | + int item = 0; |
1542 | 1543 | auto start = getSystemTime(); |
1543 | 1544 | if (useTokens) { |
1544 | 1545 | typename TQueue::producer_token_t prodTok(q); |
@@ -1585,7 +1586,7 @@ double runBenchmark(benchmark_type_t benchmark, int nthreads, bool useTokens, un |
1585 | 1586 | auto start = getSystemTime(); |
1586 | 1587 | if (id < 2) { |
1587 | 1588 | // Alternate |
1588 | | - int item; |
| 1589 | + int item = 0; |
1589 | 1590 | if (useTokens) { |
1590 | 1591 | typename TQueue::consumer_token_t consTok(q); |
1591 | 1592 | typename TQueue::producer_token_t prodTok(q); |
@@ -2020,7 +2021,7 @@ int main(int argc, char** argv) |
2020 | 2021 | int maxThreads = QUEUE_MAX_THREADS[queue]; |
2021 | 2022 | std::vector<BenchmarkResult> results(ITERATIONS); |
2022 | 2023 | for (int i = 0; i < ITERATIONS; ++i) { |
2023 | | - double elapsed; |
| 2024 | + double elapsed = 0.0; |
2024 | 2025 | counter_t ops = 0; |
2025 | 2026 |
|
2026 | 2027 | switch ((queue_id_t)queue) { |
|
0 commit comments