| 23 | const int REPS = 10; |
| 24 | |
| 25 | void autoScheduleTasks(bool enableWorkSteal) { |
| 26 | std::atomic<int> count = 0; |
| 27 | { |
| 28 | ThreadPool tp(std::thread::hardware_concurrency(), enableWorkSteal); |
| 29 | |
| 30 | for (int i = 0; i < COUNT; ++i) { |
| 31 | [[maybe_unused]] auto ret = tp.scheduleById([i, &count] { |
| 32 | count++; |
| 33 | int x; |
| 34 | auto reps = REPS + (REPS * (rand() % 5)); |
| 35 | for (int n = 0; n < reps; ++n) |
| 36 | x = i + rand(); |
| 37 | (void)x; |
| 38 | }); |
| 39 | assert(ret == ThreadPool::ERROR_TYPE::ERROR_NONE); |
| 40 | } |
| 41 | } |
| 42 | assert(count == COUNT); |
| 43 | } |
| 44 | |
| 45 | void ThreadPool_noWorkSteal(benchmark::State& state) { |
| 46 | for ([[maybe_unused]] const auto& _ : state) |
no test coverage detected