From 0e8d1ef77ad8db2b2491ae92874eb21b7986d59b Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Tue, 13 Jun 2023 14:48:03 -0400 Subject: Benchmark refactoring/cleanup --- benchmarks/include/bench.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'benchmarks/include/bench.h') diff --git a/benchmarks/include/bench.h b/benchmarks/include/bench.h index d82da48..6a9c263 100644 --- a/benchmarks/include/bench.h +++ b/benchmarks/include/bench.h @@ -1,3 +1,13 @@ +/* + * benchmarks/include/bench.h + * + * Copyright (C) 2023 Douglas Rumbaugh + * + * All rights reserved. Published under the Modified BSD License. + * + */ +#pragma once + #include "bench_utility.h" template @@ -64,4 +74,37 @@ static bool insert_tput_bench(DE &de_index, std::fstream &file, size_t insert_cn return continue_benchmark; } +template +static bool query_latency_bench(DE &de_index, 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(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