34 int main(
int argc,
char* argv[]) {
36 return jb::testing::microbenchmark_group_main<config>(
37 argc, argv, create_testcases());
47 std::chrono::microseconds
const expected_delay(1250);
48 std::chrono::microseconds
const sampling_period(10);
60 template <
typename timeseries_type>
72 explicit fixture(
int size)
80 a, expected_delay, sampling_period);
86 auto e = estimator.estimate_delay(a, b);
89 throw std::runtime_error(
"estimation failed");
91 return static_cast<int>(a.size());
109 template <
typename timeseries_type>
110 std::function<void(config const&)> test_case() {
111 return [](config
const& cfg) {
115 benchmark bm(cfg.microbenchmark());
121 bm.typical_output(r);
128 {
"float:aligned", test_case<jb::fftw::aligned_vector<float>>()},
129 {
"double:aligned", test_case<jb::fftw::aligned_vector<double>>()},
130 {
"float:unaligned", test_case<std::vector<float>>()},
131 {
"double:unaligned", test_case<std::vector<double>>()},
132 {
"complex:float:aligned",
133 test_case<jb::fftw::aligned_vector<std::complex<float>>>()},
134 {
"complex:double:aligned",
135 test_case<jb::fftw::aligned_vector<std::complex<double>>>()},
136 {
"complex:float:unaligned",
137 test_case<std::vector<std::complex<float>>>()},
138 {
"complex:double:unaligned",
139 test_case<std::vector<std::complex<double>>>()},
144 #ifndef JB_FFTW_DEFAULT_fftw_bm_time_delay_estimator_test_case 145 #define JB_FFTW_DEFAULT_fftw_bm_time_delay_estimator_test_case "float:aligned" 146 #endif // JB_FFTW_DEFAULT_fftw_bm_time_delay_estimator_test_case 148 std::string
const test_case =
153 : log(desc(
"log",
"logging"), this)
155 desc(
"microbenchmark",
"microbenchmark"), this,
156 jb::testing::microbenchmark_config().test_case(
defaults::test_case)) {
159 void config::validate()
const {
161 microbenchmark().validate();
int main(int argc, char *argv[])
Define defaults for program parameters.
timeseries_t delay_timeseries_periodic(timeseries_t const &ts, duration_t delay, duration_t sampling_period)
Delay a timeseries using a periodic extension for early values.
Base class for all configuration objects.
virtual void validate() const
Validate the settings.
A simple time delay estimator based on cross-correlation.
results run(Args &&... args)
Run the microbenchmaark.
std::map< std::string, std::function< void(config const &cfg)> > microbenchmark_group
Define a representation for a group of microbenchmarks.
void create_square_timeseries(int nsamples, timeseries &ts)
Create a simple timeseries where the values look like a square.
#define config_object_constructors(NAME)
Helper class to easily define configuration attributes.
#define JB_FFTW_DEFAULT_fftw_bm_time_delay_estimator_test_case
std::size_t nsamples(container_type const &a)
Count the elements in the last dimension of a vector-like container.
Run a micro-benchmark on a given class.
The top-level namespace for the JayBeams library.