2727#include < memory>
2828#include < span>
2929#include < thread>
30+ #include < utility>
3031#include < vector>
3132
3233#if __has_include(<memory_resource>)
33- # include < memory_resource>
34+ # include < memory_resource> // IWYU pragma: keep
3435namespace pmr = std::pmr;
3536#else
3637# define STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE 1
@@ -41,15 +42,15 @@ struct statistics {
4142 double ops_per_sec;
4243};
4344
44- statistics compute_perf (
45+ auto compute_perf (
4546 std::chrono::steady_clock::time_point start,
4647 std::chrono::steady_clock::time_point end,
47- std::size_t total_scheds) {
48+ std::size_t total_scheds) -> statistics {
4849 auto dur = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start);
4950 auto dur_ms = std::chrono::duration_cast<std::chrono::milliseconds>(dur);
5051 auto dur_dbl = std::chrono::duration_cast<std::chrono::duration<double >>(dur);
5152 double ops_per_sec = static_cast <double >(total_scheds) / dur_dbl.count ();
52- return {dur_ms, ops_per_sec};
53+ return {. total_time_ms = dur_ms, . ops_per_sec = ops_per_sec};
5354}
5455
5556struct statistics_all {
@@ -61,12 +62,12 @@ struct statistics_all {
6162 double stddev;
6263};
6364
64- statistics_all compute_perf (
65+ auto compute_perf (
6566 std::span<const std::chrono::steady_clock::time_point> start,
6667 std::span<const std::chrono::steady_clock::time_point> end,
6768 std::size_t i0,
6869 std::size_t i,
69- std::size_t total_scheds) {
70+ std::size_t total_scheds) -> statistics_all {
7071 double average = 0.0 ;
7172 double max = 0.0 ;
7273 double min = std::numeric_limits<double >::max ();
@@ -85,7 +86,13 @@ statistics_all compute_perf(
8586 variance /= static_cast <double >(i + 1 - i0);
8687 double stddev = std::sqrt (variance);
8788 auto stats = compute_perf (start[i], end[i], total_scheds);
88- statistics_all all{stats.total_time_ms , stats.ops_per_sec , average, max, min, stddev};
89+ statistics_all all{
90+ .total_time_ms = stats.total_time_ms ,
91+ .ops_per_sec = stats.ops_per_sec ,
92+ .average = average,
93+ .max = max,
94+ .min = min,
95+ .stddev = stddev};
8996 return all;
9097}
9198
@@ -119,15 +126,15 @@ void my_main(int argc, char** argv, exec::numa_policy policy = exec::get_numa_po
119126 std::atomic<bool > stop{false };
120127#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
121128 std::size_t buffer_size = 2000 << 20 ;
122- for (std::size_t i = 0 ; i < static_cast < std::size_t >( nthreads); ++i) {
129+ for (std::size_t i = 0 ; std::cmp_less (i, nthreads); ++i) {
123130 exec::numa_allocator<char > alloc (policy.thread_index_to_node (i));
124131 buffers.push_back (
125132 std::unique_ptr<char , numa_deleter>{
126- alloc.allocate (buffer_size), numa_deleter{buffer_size, alloc}
133+ alloc.allocate (buffer_size), numa_deleter{. size_ = buffer_size, . allocator_ = alloc}
127134 });
128135 }
129136#endif
130- for (std::size_t i = 0 ; i < static_cast < std::size_t >( nthreads); ++i) {
137+ for (std::size_t i = 0 ; std::cmp_less (i, nthreads); ++i) {
131138 threads.emplace_back (
132139 RunThread{},
133140 std::ref (*pool),
0 commit comments