| 29 | } |
| 30 | |
| 31 | int main() { |
| 32 | const int total_estimations = 1000; |
| 33 | const int points_per_estimation = 100000; |
| 34 | const int thread_count = std::thread::hardware_concurrency(); |
| 35 | const int estimations_per_thread = total_estimations / thread_count; |
| 36 | |
| 37 | std::vector<std::thread> threads; |
| 38 | |
| 39 | for (int i = 0; i < thread_count; ++i) { |
| 40 | threads.emplace_back(run_estimations, estimations_per_thread, points_per_estimation); |
| 41 | } |
| 42 | |
| 43 | for (auto& thread : threads) { |
| 44 | thread.join(); |
| 45 | } |
| 46 | |
| 47 | std::cout << "Completed " << total_estimations << " pi estimations" << std::endl; |
| 48 | ctrack::result_print(); |
| 49 | |
| 50 | return 0; |
| 51 | } |
nothing calls this directly
no test coverage detected