index &= index_mask;
std::atomic<T> *atomic = &(*buf)[index];
input ^= static_cast<T>(iteration);
- return fn(input, atomic);
+ return fn(input, atomic, iteration ^ thread_num);
},
T{}, name_parts...);
}
{
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_exchange_explicit(atomic, input, order);
},
"atomic_exchange_", int_type_name<T>, "_", memory_order_name<order>);
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_fetch_add_explicit(atomic, input, order);
},
"atomic_fetch_add_", int_type_name<T>, "_", memory_order_name<order>);
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_fetch_sub_explicit(atomic, input, order);
},
"atomic_fetch_sub_", int_type_name<T>, "_", memory_order_name<order>);
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_fetch_and_explicit(atomic, input, order);
},
"atomic_fetch_and_", int_type_name<T>, "_", memory_order_name<order>);
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_fetch_or_explicit(atomic, input, order);
},
"atomic_fetch_or_", int_type_name<T>, "_", memory_order_name<order>);
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_fetch_xor_explicit(atomic, input, order);
},
"atomic_fetch_xor_", int_type_name<T>, "_", memory_order_name<order>);
{
push_atomic_bench(
benches, config, buf,
- [](T, std::atomic<T> *atomic) {
+ [](T, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_load_explicit(atomic, order);
},
"atomic_load_", int_type_name<T>, "_", memory_order_name<order>);
{
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
+ [](T input, std::atomic<T> *atomic, std::uint64_t) {
return std::atomic_store_explicit(atomic, input, order);
},
"atomic_store_", int_type_name<T>, "_", memory_order_name<order>);
{
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
- T expected = input >> 1;
+ [](T input, std::atomic<T> *atomic, std::uint64_t state) {
+ T expected = state;
bool succeeded = std::atomic_compare_exchange_weak_explicit(
atomic, &expected, input, succ, fail);
return std::pair(expected, succeeded);
memory_order_name<succ>, "_", memory_order_name<fail>);
push_atomic_bench(
benches, config, buf,
- [](T input, std::atomic<T> *atomic) {
- T expected = input >> 1;
+ [](T input, std::atomic<T> *atomic, std::uint64_t state) {
+ T expected = state;
bool succeeded = std::atomic_compare_exchange_strong_explicit(
atomic, &expected, input, succ, fail);
return std::pair(expected, succeeded);
benchmarks<std::int32_t>(benches, config);
benchmarks<std::int64_t>(benches, config);
return benches;
-}
\ No newline at end of file
+}