template <typename T> using Buf = std::shared_ptr<std::vector<std::atomic<T>>>;
template <typename Fn, typename T, typename... NameParts>
-static void push_atomic_bench(std::vector<Benchmark> &benches, Config config,
- Buf<T> buf, Fn fn, NameParts &&...name_parts)
+static void push_atomic_bench(std::vector<Benchmark> &benches,
+ const Config &config, Buf<T> buf, Fn fn,
+ NameParts &&...name_parts)
{
auto log2_stride = config.log2_stride;
std::size_t index_mask = 1;
}
template <typename T, std::memory_order order>
-static void rmw_benchmarks(std::vector<Benchmark> &benches, Config config,
- Buf<T> buf)
+static void rmw_benchmarks(std::vector<Benchmark> &benches,
+ const Config &config, Buf<T> buf)
{
push_atomic_bench(
benches, config, buf,
}
template <typename T, std::memory_order order>
-static void load_benchmarks(std::vector<Benchmark> &benches, Config config,
- Buf<T> buf)
+static void load_benchmarks(std::vector<Benchmark> &benches,
+ const Config &config, Buf<T> buf)
{
push_atomic_bench(
benches, config, buf,
}
template <typename T, std::memory_order order>
-static void store_benchmarks(std::vector<Benchmark> &benches, Config config,
- Buf<T> buf)
+static void store_benchmarks(std::vector<Benchmark> &benches,
+ const Config &config, Buf<T> buf)
{
push_atomic_bench(
benches, config, buf,
}
template <typename T, std::memory_order succ, std::memory_order fail>
-static void cmp_xchg_benchmarks(std::vector<Benchmark> &benches, Config config,
- Buf<T> buf)
+static void cmp_xchg_benchmarks(std::vector<Benchmark> &benches,
+ const Config &config, Buf<T> buf)
{
push_atomic_bench(
benches, config, buf,
}
template <typename T>
-static void benchmarks(std::vector<Benchmark> &benches, Config config)
+static void benchmarks(std::vector<Benchmark> &benches, const Config &config)
{
std::size_t buf_size = 1;
buf_size <<= config.log2_memory_location_count;
std::memory_order_seq_cst>(benches, config, buf);
}
-std::vector<Benchmark> c11_atomics_benchmarks(Config config)
+std::vector<Benchmark> c11_atomics_benchmarks(const Config &config)
{
std::vector<Benchmark> benches;
benchmarks<std::uint8_t>(benches, config);