From 957bd0b2ed7d41ecba6c558a3f2749803f5a2c02 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Thu, 27 Jul 2023 18:22:22 -0400 Subject: PGM-based Point Lookup benchmarks --- benchmarks/include/standalone_utility.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'benchmarks/include/standalone_utility.h') 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 +static std::vector read_lookup_queries(std::string fname, double selectivity) { + std::vector 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 static std::vector read_range_queries(std::string fname, double selectivity) { std::vector queries; -- cgit v1.2.3