summaryrefslogtreecommitdiffstats
path: root/benchmarks/tail-latency
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2025-01-21 13:11:12 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2025-02-17 09:09:43 -0500
commit4e088dd606cc60f0e6585f1a1512a65a8a549876 (patch)
tree7ac1dfce4db0fd40b6468addc9dd9ffe327122a6 /benchmarks/tail-latency
parent78ecacfa46f6418fca7562cda8e79c766ddf7191 (diff)
downloaddynamic-extension-4e088dd606cc60f0e6585f1a1512a65a8a549876.tar.gz
BTree insertion latency benchmarks
Diffstat (limited to 'benchmarks/tail-latency')
-rw-r--r--benchmarks/tail-latency/btree_insert_dist.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/benchmarks/tail-latency/btree_insert_dist.cpp b/benchmarks/tail-latency/btree_insert_dist.cpp
new file mode 100644
index 0000000..af60819
--- /dev/null
+++ b/benchmarks/tail-latency/btree_insert_dist.cpp
@@ -0,0 +1,77 @@
+/*
+ *
+ */
+
+#define ENABLE_TIMER
+
+#include "shard/ISAMTree.h"
+#include "query/rangequery.h"
+#include "framework/interface/Record.h"
+#include "file_util.h"
+#include "benchmark_types.h"
+
+#include <gsl/gsl_rng.h>
+
+#include "psu-util/timer.h"
+#include "standard_benchmarks.h"
+#include "psu-ds/BTree.h"
+
+typedef btree_record<int64_t, int64_t> Rec;
+
+typedef de::ISAMTree<Rec> Shard;
+typedef de::irs::Query<Shard> Q;
+typedef Q::Parameters QP;
+
+void usage(char *progname) {
+ fprintf(stderr, "%s reccnt datafile queryfile\n", progname);
+}
+
+int main(int argc, char **argv) {
+
+ if (argc < 4) {
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ size_t n = atol(argv[1]);
+ std::string d_fname = std::string(argv[2]);
+ std::string q_fname = std::string(argv[3]);
+
+ auto btree = BenchBTree();
+
+ auto data = read_sosd_file<Rec>(d_fname, n);
+
+ /* read in the range queries and add sample size and rng for sampling */
+ auto queries = read_range_queries<QP>(q_fname, .0001);
+
+ /* warmup structure w/ 10% of records */
+ size_t warmup = .1 * n;
+ for (size_t i=0; i<warmup; i++) {
+ btree.insert(data[i]);
+ }
+
+ TIMER_INIT();
+ /* insertion benchmark */
+ for (size_t i=warmup; i<data.size(); i++) {
+ TIMER_START();
+ btree.insert(data[i]);
+ TIMER_STOP();
+
+ fprintf(stdout, "I\t%ld\n", TIMER_RESULT());
+ }
+
+ /* run queries */
+ size_t total = 0;
+ for (size_t j=0; j<10; j++) {
+ for (size_t i=0; i<queries.size(); i++) {
+ TIMER_START();
+ total += btree.range_count(queries[i].lower_bound, queries[i].upper_bound);
+ TIMER_STOP();
+
+ fprintf(stdout, "Q\t%ld\n", TIMER_RESULT());
+ }
+ }
+
+ fprintf(stderr, "%ld\n", total);
+}
+