From 0a9e79416df03a9e0a3d2cf171cf90028a644d6d Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Mon, 15 Jan 2024 17:21:11 -0500 Subject: Benchmarking programs --- benchmarks/mtree_knn_bench.cpp | 83 ------------------------------------------ 1 file changed, 83 deletions(-) delete mode 100644 benchmarks/mtree_knn_bench.cpp (limited to 'benchmarks/mtree_knn_bench.cpp') diff --git a/benchmarks/mtree_knn_bench.cpp b/benchmarks/mtree_knn_bench.cpp deleted file mode 100644 index 9d4cc57..0000000 --- a/benchmarks/mtree_knn_bench.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "include/bench.h" -#include "mtree.h" - -static void mtree_knn_bench(MTree &tree, std::vector> queries, size_t trial_cnt=1) -{ - char progbuf[25]; - sprintf(progbuf, "sampling:"); - - size_t batch_size = 100; - size_t batches = trial_cnt / batch_size; - size_t total_time = 0; - - std::vector result_set; - - for (int i=0; i results; - - auto start = std::chrono::high_resolution_clock::now(); - for (size_t j=0; jdata); - itr++; - } - } - auto stop = std::chrono::high_resolution_clock::now(); - - total_time += std::chrono::duration_cast(stop - start).count(); - } - - progress_update(1.0, progbuf); - - size_t latency = total_time / (trial_cnt * queries.size()); - - fprintf(stdout, "%ld\t", latency); -} - -int main(int argc, char **argv) -{ - if (argc < 5) { - fprintf(stderr, "Usage: mtree_knn_bench [k]\n"); - exit(EXIT_FAILURE); - } - - std::string filename = std::string(argv[1]); - size_t record_count = atol(argv[2]); - double delete_prop = atof(argv[3]); - std::string qfilename = std::string(argv[4]); - size_t k = (argc == 6) ? atol(argv[5]) : 10; - - init_bench_env(record_count, true); - auto queries = read_knn_queries>(qfilename, k); - - auto mtree = MTree(); - - std::fstream datafile; - datafile.open(filename, std::ios::in | std::ios::binary); - - std::vector to_delete; - - // warm up the tree with initial_insertions number of initially inserted - // records - size_t warmup_cnt = 0.1 * record_count; - warmup(datafile, mtree, warmup_cnt, delete_prop, to_delete, true, true); - - size_t insert_cnt = record_count - warmup_cnt; - - insert_tput_bench(mtree, datafile, insert_cnt, delete_prop, to_delete, true); - // fprintf(stdout, "%ld\t", mtree.get_memory_usage()); - - mtree_knn_bench(mtree, queries); - fprintf(stdout, "\n"); - - delete_bench_env(); - fflush(stdout); - fflush(stderr); - - exit(EXIT_SUCCESS); -} -- cgit v1.2.3