From 9864552a3f2b533c47076a7f6efe246e77deb440 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 26 Jun 2023 10:09:46 -0400 Subject: Added static benchmarking --- benchmarks/include/bench.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'benchmarks/include') diff --git a/benchmarks/include/bench.h b/benchmarks/include/bench.h index 6a9c263..db8fc77 100644 --- a/benchmarks/include/bench.h +++ b/benchmarks/include/bench.h @@ -108,3 +108,44 @@ static bool query_latency_bench(DE &de_index, std::vector queries, size_t tr return true; } + + +template +static bool static_latency_bench(Shard *shard, std::vector queries, size_t trial_cnt=100) { + char progbuf[25]; + if constexpr (PROGRESS) { + sprintf(progbuf, "querying:"); + } + + size_t total_time = 0; + size_t total_results = 0; + + for (size_t i=0; i states(1); + + auto start = std::chrono::high_resolution_clock::now(); + for (size_t j=0; j(stop - start).count(); + } + + progress_update(1.0, progbuf); + + size_t query_latency = total_time / (trial_cnt * queries.size()); + + fprintf(stdout, "%ld\t", query_latency); + fflush(stdout); + + return true; +} -- cgit v1.2.3