MCPcopy Create free account
hub / github.com/Compaile/ctrack / main

Function main

examples/high_variance_pi_estimation.cpp:31–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31int 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}

Callers

nothing calls this directly

Calls 1

result_printFunction · 0.85

Tested by

no test coverage detected