diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-27 18:22:22 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-27 18:22:22 -0400 |
| commit | 957bd0b2ed7d41ecba6c558a3f2749803f5a2c02 (patch) | |
| tree | 892bcb4065bf4d5daf7e3e79018d607fc6a51cfa /benchmarks/include/standalone_utility.h | |
| parent | d6e08e9d8d3ac9b356ac50cee22b41f828160247 (diff) | |
| download | dynamic-extension-957bd0b2ed7d41ecba6c558a3f2749803f5a2c02.tar.gz | |
PGM-based Point Lookup benchmarks
Diffstat (limited to 'benchmarks/include/standalone_utility.h')
| -rw-r--r-- | benchmarks/include/standalone_utility.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/benchmarks/include/standalone_utility.h b/benchmarks/include/standalone_utility.h index 272a332..9876e84 100644 --- a/benchmarks/include/standalone_utility.h +++ b/benchmarks/include/standalone_utility.h @@ -84,6 +84,26 @@ static void delete_bench_env() gsl_rng_free(g_rng); } + +template <typename QP> +static std::vector<QP> read_lookup_queries(std::string fname, double selectivity) { + std::vector<QP> queries; + + FILE *qf = fopen(fname.c_str(), "r"); + size_t start, stop; + double sel; + while (fscanf(qf, "%zu%zu%lf\n", &start, &stop, &sel) != EOF) { + if (start < stop && std::abs(sel - selectivity) < 0.1) { + QP q; + q.target_key = start; + queries.push_back(q); + } + } + fclose(qf); + + return queries; +} + template <typename QP> static std::vector<QP> read_range_queries(std::string fname, double selectivity) { std::vector<QP> queries; |