projects
/
benchmarks.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ba5adc2
)
Config is getting big, pass by reference rather than value
author
Jacob Lifshay
<programmerjake@gmail.com>
Wed, 27 Jul 2022 01:29:47 +0000
(18:29 -0700)
committer
Jacob Lifshay
<programmerjake@gmail.com>
Wed, 27 Jul 2022 01:29:47 +0000
(18:29 -0700)
14 files changed:
src/aarch64/aarch64_benchmarks.cpp
patch
|
blob
|
history
src/aarch64/aarch64_benchmarks.h
patch
|
blob
|
history
src/all_benchmarks.cpp
patch
|
blob
|
history
src/all_benchmarks.h
patch
|
blob
|
history
src/common/c11_atomics/c11_atomics_benchmarks.cpp
patch
|
blob
|
history
src/common/c11_atomics/c11_atomics_benchmarks.h
patch
|
blob
|
history
src/common/common_benchmarks.cpp
patch
|
blob
|
history
src/common/common_benchmarks.h
patch
|
blob
|
history
src/harness.cpp
patch
|
blob
|
history
src/harness.h
patch
|
blob
|
history
src/powerpc64le/powerpc64le_benchmarks.cpp
patch
|
blob
|
history
src/powerpc64le/powerpc64le_benchmarks.h
patch
|
blob
|
history
src/x86_64/x86_64_benchmarks.cpp
patch
|
blob
|
history
src/x86_64/x86_64_benchmarks.h
patch
|
blob
|
history
diff --git
a/src/aarch64/aarch64_benchmarks.cpp
b/src/aarch64/aarch64_benchmarks.cpp
index 81f729c0142dac824338ff8c56522c70f32b9c70..2e39a351aa8f6d206894201fe9a6a42a23b75ea9 100644
(file)
--- a/
src/aarch64/aarch64_benchmarks.cpp
+++ b/
src/aarch64/aarch64_benchmarks.cpp
@@
-2,7
+2,7
@@
#ifdef __aarch64__
#ifdef __aarch64__
-std::vector<Benchmark> aarch64_benchmarks(
Config
config)
+std::vector<Benchmark> aarch64_benchmarks(
const Config &
config)
{
std::vector<Benchmark> retval;
// TODO: add aarch64 benchmarks
{
std::vector<Benchmark> retval;
// TODO: add aarch64 benchmarks
@@
-12,9
+12,9
@@
std::vector<Benchmark> aarch64_benchmarks(Config config)
#else
#else
-std::vector<Benchmark> aarch64_benchmarks(
Config
)
+std::vector<Benchmark> aarch64_benchmarks(
const Config &
)
{
return {};
}
{
return {};
}
-#endif
\ No newline at end of file
+#endif
diff --git
a/src/aarch64/aarch64_benchmarks.h
b/src/aarch64/aarch64_benchmarks.h
index b79cc9f47f6248a99bd830716c72a4a5cc85b3f4..47a751ca18380d1d9cfaa5cc04350fb369836ee3 100644
(file)
--- a/
src/aarch64/aarch64_benchmarks.h
+++ b/
src/aarch64/aarch64_benchmarks.h
@@
-2,4
+2,4
@@
#include "../harness.h"
#include "../harness.h"
-std::vector<Benchmark> aarch64_benchmarks(Config config);
\ No newline at end of file
+std::vector<Benchmark> aarch64_benchmarks(const Config &config);
diff --git
a/src/all_benchmarks.cpp
b/src/all_benchmarks.cpp
index 748541c0fca64413a0e7ee9e4c96a027fe2491af..e136c4a3ae31019f3e1df3e462f76789ba1402e4 100644
(file)
--- a/
src/all_benchmarks.cpp
+++ b/
src/all_benchmarks.cpp
@@
-6,7
+6,7
@@
#include <algorithm>
#include <iterator>
#include <algorithm>
#include <iterator>
-std::vector<Benchmark> all_benchmarks(
Config
config)
+std::vector<Benchmark> all_benchmarks(
const Config &
config)
{
std::vector<Benchmark> retval = common_benchmarks(config);
{
{
std::vector<Benchmark> retval = common_benchmarks(config);
{
@@
-25,4
+25,4
@@
std::vector<Benchmark> all_benchmarks(Config config)
std::back_inserter(retval));
}
return retval;
std::back_inserter(retval));
}
return retval;
-}
\ No newline at end of file
+}
diff --git
a/src/all_benchmarks.h
b/src/all_benchmarks.h
index 9447131646abe608f5b9a82d48290c1774085702..b759cf65b946c1d615e47720ddc8abffc92f3176 100644
(file)
--- a/
src/all_benchmarks.h
+++ b/
src/all_benchmarks.h
@@
-2,4
+2,4
@@
#include "harness.h"
#include "harness.h"
-std::vector<Benchmark> all_benchmarks(Config config);
\ No newline at end of file
+std::vector<Benchmark> all_benchmarks(const Config &config);
diff --git
a/src/common/c11_atomics/c11_atomics_benchmarks.cpp
b/src/common/c11_atomics/c11_atomics_benchmarks.cpp
index 01f831c94812b1455a2eb9ed8b752c2172e87e94..20d02b0ac18708627f678e49d33d86998e59537d 100644
(file)
--- a/
src/common/c11_atomics/c11_atomics_benchmarks.cpp
+++ b/
src/common/c11_atomics/c11_atomics_benchmarks.cpp
@@
-47,8
+47,9
@@
MEMORY_ORDER_NAME(seq_cst)
template <typename T> using Buf = std::shared_ptr<std::vector<std::atomic<T>>>;
template <typename Fn, typename T, typename... NameParts>
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;
{
auto log2_stride = config.log2_stride;
std::size_t index_mask = 1;
@@
-71,8
+72,8
@@
static void push_atomic_bench(std::vector<Benchmark> &benches, Config config,
}
template <typename T, std::memory_order order>
}
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,
{
push_atomic_bench(
benches, config, buf,
@@
-113,8
+114,8
@@
static void rmw_benchmarks(std::vector<Benchmark> &benches, Config config,
}
template <typename T, std::memory_order order>
}
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,
{
push_atomic_bench(
benches, config, buf,
@@
-125,8
+126,8
@@
static void load_benchmarks(std::vector<Benchmark> &benches, Config config,
}
template <typename T, std::memory_order order>
}
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,
{
push_atomic_bench(
benches, config, buf,
@@
-137,8
+138,8
@@
static void store_benchmarks(std::vector<Benchmark> &benches, Config config,
}
template <typename T, std::memory_order succ, std::memory_order fail>
}
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,
{
push_atomic_bench(
benches, config, buf,
@@
-163,7
+164,7
@@
static void cmp_xchg_benchmarks(std::vector<Benchmark> &benches, Config config,
}
template <typename T>
}
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::size_t buf_size = 1;
buf_size <<= config.log2_memory_location_count;
@@
-208,7
+209,7
@@
static void benchmarks(std::vector<Benchmark> &benches, Config config)
std::memory_order_seq_cst>(benches, config, buf);
}
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);
{
std::vector<Benchmark> benches;
benchmarks<std::uint8_t>(benches, config);
diff --git
a/src/common/c11_atomics/c11_atomics_benchmarks.h
b/src/common/c11_atomics/c11_atomics_benchmarks.h
index 9966297dfe83d802b68f43be89fc75bae14529cc..27baed912d91e39dfb56ac6fed897d971fa995ec 100644
(file)
--- a/
src/common/c11_atomics/c11_atomics_benchmarks.h
+++ b/
src/common/c11_atomics/c11_atomics_benchmarks.h
@@
-2,4
+2,4
@@
#include "../../harness.h"
#include "../../harness.h"
-std::vector<Benchmark> c11_atomics_benchmarks(Config config);
\ No newline at end of file
+std::vector<Benchmark> c11_atomics_benchmarks(const Config &config);
diff --git
a/src/common/common_benchmarks.cpp
b/src/common/common_benchmarks.cpp
index 42007a48a5ace9d6cfe0eba8b8367bc07f5f3a31..3179ec78172e44d8a020c817eda89246145b048a 100644
(file)
--- a/
src/common/common_benchmarks.cpp
+++ b/
src/common/common_benchmarks.cpp
@@
-1,8
+1,8
@@
#include "common_benchmarks.h"
#include "c11_atomics/c11_atomics_benchmarks.h"
#include "common_benchmarks.h"
#include "c11_atomics/c11_atomics_benchmarks.h"
-std::vector<Benchmark> common_benchmarks(
Config
config)
+std::vector<Benchmark> common_benchmarks(
const Config &
config)
{
auto retval = c11_atomics_benchmarks(config);
return retval;
{
auto retval = c11_atomics_benchmarks(config);
return retval;
-}
\ No newline at end of file
+}
diff --git
a/src/common/common_benchmarks.h
b/src/common/common_benchmarks.h
index 9505408927dc69acda0fe5ba432ac6b8de1327d1..e3c24b1dc2f2442709c8649e417991952b661de8 100644
(file)
--- a/
src/common/common_benchmarks.h
+++ b/
src/common/common_benchmarks.h
@@
-2,4
+2,4
@@
#include "../harness.h"
#include "../harness.h"
-std::vector<Benchmark> common_benchmarks(Config config);
\ No newline at end of file
+std::vector<Benchmark> common_benchmarks(const Config &config);
diff --git
a/src/harness.cpp
b/src/harness.cpp
index affe91997d7c023f5b09d696e4bdd9cb93ce5220..e28eac94ea70ca44cee9febcbb3fc76293ec0a7e 100644
(file)
--- a/
src/harness.cpp
+++ b/
src/harness.cpp
@@
-172,7
+172,7
@@
struct WriteDuration final
};
void BenchHarnessBase::base_run(
};
void BenchHarnessBase::base_run(
-
Config
config,
+
const Config &
config,
void (*fn)(BenchHarnessBase *bench_harness_base,
std::uint64_t iteration_count, std::uint32_t thread_num))
{
void (*fn)(BenchHarnessBase *bench_harness_base,
std::uint64_t iteration_count, std::uint32_t thread_num))
{
@@
-259,4
+259,4
@@
void BenchHarnessBase::base_run(
std::shared_ptr<void> BenchHarnessBase::get_thread_cache()
{
return ThreadCache::get();
std::shared_ptr<void> BenchHarnessBase::get_thread_cache()
{
return ThreadCache::get();
-}
\ No newline at end of file
+}
diff --git
a/src/harness.h
b/src/harness.h
index f623114ba4d862891686979af67b8100f6680f95..72ee8d1c36458141018030b95cdbc37270517e30 100644
(file)
--- a/
src/harness.h
+++ b/
src/harness.h
@@
-30,7
+30,7
@@
class BenchHarnessBase
std::shared_ptr<void> thread_cache;
class ThreadCache;
friend class ThreadCache;
std::shared_ptr<void> thread_cache;
class ThreadCache;
friend class ThreadCache;
- void base_run(
Config
config,
+ void base_run(
const Config &
config,
void (*fn)(BenchHarnessBase *bench_harness_base,
std::uint64_t iteration_count,
std::uint32_t thread_num));
void (*fn)(BenchHarnessBase *bench_harness_base,
std::uint64_t iteration_count,
std::uint32_t thread_num));
@@
-51,7
+51,7
@@
class BenchHarness final : private BenchHarnessBase
: fn(std::move(fn)), input(std::move(input))
{
}
: fn(std::move(fn)), input(std::move(input))
{
}
- void run(
Config
config)
+ void run(
const Config &
config)
{
base_run(config, [](BenchHarnessBase *bench_harness_base,
std::uint64_t iteration_count,
{
base_run(config, [](BenchHarnessBase *bench_harness_base,
std::uint64_t iteration_count,
@@
-88,17
+88,17
@@
class Benchmark final
{
private:
std::string m_name;
{
private:
std::string m_name;
- std::function<void(
Config
config)> m_run;
+ std::function<void(
const Config &
config)> m_run;
public:
template <typename Fn, typename Input>
explicit Benchmark(Fn fn, Input input, std::string name)
public:
template <typename Fn, typename Input>
explicit Benchmark(Fn fn, Input input, std::string name)
- : m_name(std::move(name)), m_run([fn, input](
Config
config) {
+ : m_name(std::move(name)), m_run([fn, input](
const Config &
config) {
return BenchHarness(std::move(fn), std::move(input)).run(config);
})
{
}
return BenchHarness(std::move(fn), std::move(input)).run(config);
})
{
}
- void run(
Config
config)
+ void run(
const Config &
config)
{
return m_run(config);
}
{
return m_run(config);
}
diff --git
a/src/powerpc64le/powerpc64le_benchmarks.cpp
b/src/powerpc64le/powerpc64le_benchmarks.cpp
index da0a672073229db75beab65ceca1548ebc5ebaf9..f4f803e5697ff33f737bd5f5b453a25bc7171334 100644
(file)
--- a/
src/powerpc64le/powerpc64le_benchmarks.cpp
+++ b/
src/powerpc64le/powerpc64le_benchmarks.cpp
@@
-3,7
+3,7
@@
#if defined(__powerpc64__) && BYTE_ORDER == LITTLE_ENDIAN
#if defined(__powerpc64__) && BYTE_ORDER == LITTLE_ENDIAN
-std::vector<Benchmark> powerpc64le_benchmarks(
Config
config)
+std::vector<Benchmark> powerpc64le_benchmarks(
const Config &
config)
{
std::vector<Benchmark> retval;
// TODO: add powerpc64le benchmarks
{
std::vector<Benchmark> retval;
// TODO: add powerpc64le benchmarks
@@
-13,9
+13,9
@@
std::vector<Benchmark> powerpc64le_benchmarks(Config config)
#else
#else
-std::vector<Benchmark> powerpc64le_benchmarks(
Config
)
+std::vector<Benchmark> powerpc64le_benchmarks(
const Config &
)
{
return {};
}
{
return {};
}
-#endif
\ No newline at end of file
+#endif
diff --git
a/src/powerpc64le/powerpc64le_benchmarks.h
b/src/powerpc64le/powerpc64le_benchmarks.h
index 808685d02da7b3a74791cce20b0edf3d84204b8c..b4fbc1471f3d5fdd3b13e6467413af2b6fd3a8ed 100644
(file)
--- a/
src/powerpc64le/powerpc64le_benchmarks.h
+++ b/
src/powerpc64le/powerpc64le_benchmarks.h
@@
-2,4
+2,4
@@
#include "../harness.h"
#include "../harness.h"
-std::vector<Benchmark> powerpc64le_benchmarks(Config config);
\ No newline at end of file
+std::vector<Benchmark> powerpc64le_benchmarks(const Config &config);
diff --git
a/src/x86_64/x86_64_benchmarks.cpp
b/src/x86_64/x86_64_benchmarks.cpp
index 9bc145fb3f16f0307dcc6c27b3f3300ad14d98cf..83a02ff50afd643381d80e66f667ec37164911b7 100644
(file)
--- a/
src/x86_64/x86_64_benchmarks.cpp
+++ b/
src/x86_64/x86_64_benchmarks.cpp
@@
-2,7
+2,7
@@
#ifdef __x86_64__
#ifdef __x86_64__
-std::vector<Benchmark> x86_64_benchmarks(
Config
config)
+std::vector<Benchmark> x86_64_benchmarks(
const Config &
config)
{
std::vector<Benchmark> retval;
// TODO: add x86_64 benchmarks
{
std::vector<Benchmark> retval;
// TODO: add x86_64 benchmarks
@@
-12,9
+12,9
@@
std::vector<Benchmark> x86_64_benchmarks(Config config)
#else
#else
-std::vector<Benchmark> x86_64_benchmarks(
Config
)
+std::vector<Benchmark> x86_64_benchmarks(
const Config &
)
{
return {};
}
{
return {};
}
-#endif
\ No newline at end of file
+#endif
diff --git
a/src/x86_64/x86_64_benchmarks.h
b/src/x86_64/x86_64_benchmarks.h
index ed228afd31cfc5426f6c587581c9ba3f235942b0..7e93d428f73daccb3bd32e93ee4446c93fa0feed 100644
(file)
--- a/
src/x86_64/x86_64_benchmarks.h
+++ b/
src/x86_64/x86_64_benchmarks.h
@@
-2,4
+2,4
@@
#include "../harness.h"
#include "../harness.h"
-std::vector<Benchmark> x86_64_benchmarks(Config config);
\ No newline at end of file
+std::vector<Benchmark> x86_64_benchmarks(const Config &config);