diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2025-05-25 14:15:36 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2025-05-25 14:15:36 -0400 |
| commit | cd961cc231ca3073f03d82b99153a6d0f5a4c7f1 (patch) | |
| tree | 706b4e8b8ceaa15c61ac5f1bcbb3daa40f32d76e /benchmarks/include/file_util.h | |
| parent | 7f823ef35733230d3fd1e12e52fecde89f415e8b (diff) | |
| download | dynamic-extension-cd961cc231ca3073f03d82b99153a6d0f5a4c7f1.tar.gz | |
Added selectivity sweep benchmark
Diffstat (limited to 'benchmarks/include/file_util.h')
| -rw-r--r-- | benchmarks/include/file_util.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/benchmarks/include/file_util.h b/benchmarks/include/file_util.h index 39b297b..2d340e6 100644 --- a/benchmarks/include/file_util.h +++ b/benchmarks/include/file_util.h @@ -87,6 +87,26 @@ static std::vector<QP> read_range_queries(std::string &fname, } template <typename QP> +static std::vector<QP> generate_uniform_range_queries(size_t n, size_t key_limit, double selectivity) { + std::vector<QP> queries; + + gsl_rng *rng = gsl_rng_alloc(gsl_rng_mt19937); + size_t query_size = key_limit * selectivity; + + for (size_t i=0; i<n; i++) { + QP q; + q.lower_bound = gsl_rng_uniform_int(rng, key_limit - query_size); + q.upper_bound = q.lower_bound + query_size; + + queries.push_back(q); + } + + gsl_rng_free(rng); + + return queries; +} + +template <typename QP> static std::vector<QP> read_sosd_point_lookups(std::string &fname, size_t n) { std::vector<QP> queries; |