From 4aa907d6275b1b74be87ed2f2e94d8a2719a6a97 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Wed, 24 Jan 2024 11:31:28 -0500 Subject: Multithreaded Insertion Benchmark --- benchmarks/insertion_tput.cpp | 48 +++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'benchmarks/insertion_tput.cpp') diff --git a/benchmarks/insertion_tput.cpp b/benchmarks/insertion_tput.cpp index 5498f93..785b933 100644 --- a/benchmarks/insertion_tput.cpp +++ b/benchmarks/insertion_tput.cpp @@ -18,27 +18,53 @@ typedef de::rq::Query Q; typedef de::DynamicExtension Ext; +void insert_thread(int64_t start, int64_t end, Ext *extension) { + for (int64_t i=start; iinsert(r)) { + _mm_pause(); + } + } +} + int main(int argc, char **argv) { - auto extension = new Ext(1000, 10000, 2); size_t n = 1000000000; - size_t per_trial = 1000; - TIMER_INIT(); - for (int64_t i=0; i counts = {1, 2, 4, 8}; //, 16, 32, 64}; + + + for (auto thread_count : counts) { + + auto extension = new Ext(1000, 12000, 8); + + size_t per_thread = n / thread_count; + + std::thread threads[thread_count]; + + TIMER_INIT(); TIMER_START(); - for (int64_t j=0; jinsert(r)) { - _mm_pause(); - } + for (size_t i=0; iget_record_count(), insert_lat, per_trial); + auto total_time = TIMER_RESULT(); + + double tput = (double) n / (double) total_time * 1e9; + + fprintf(stdout, "%ld\t%d\t%lf\n", extension->get_record_count(), + thread_count, tput); + + delete extension; } fflush(stderr); -- cgit v1.2.3