| 104 | } |
| 105 | |
| 106 | int main() |
| 107 | { |
| 108 | boost::asio::thread_pool pool(4); |
| 109 | |
| 110 | std::vector<int> values(100'000'000); |
| 111 | |
| 112 | std::random_device random_device; |
| 113 | std::mt19937 rng(random_device()); |
| 114 | std::uniform_int_distribution<int> dist(1, 1'000'000); |
| 115 | std::generate(values.begin(), values.end(), [&]{ return dist(rng); }); |
| 116 | |
| 117 | std::cout << "starting sort\n"; |
| 118 | |
| 119 | auto begin = std::chrono::high_resolution_clock::now(); |
| 120 | |
| 121 | parallel_sort( |
| 122 | pool.get_executor(), |
| 123 | values.begin(), |
| 124 | values.end(), |
| 125 | boost::asio::use_future |
| 126 | ).get(); |
| 127 | |
| 128 | auto end = std::chrono::high_resolution_clock::now(); |
| 129 | |
| 130 | auto duration = end - begin; |
| 131 | std::cout << "sort took " |
| 132 | << std::chrono::duration_cast<std::chrono::microseconds>(duration).count() |
| 133 | << " microseconds\n"; |
| 134 | } |
nothing calls this directly
no test coverage detected