From 992da32a02c8137833674fb0eac46a6116dad3a6 Mon Sep 17 00:00:00 2001 From: Nobuhiro Ban Date: Thu, 14 Nov 2024 16:23:13 +0900 Subject: [PATCH] ycsb: add option to change epoch duration --- bench/ycsb/ycsb.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bench/ycsb/ycsb.cpp b/bench/ycsb/ycsb.cpp index e75131eb5..5225c6e8a 100644 --- a/bench/ycsb/ycsb.cpp +++ b/bench/ycsb/ycsb.cpp @@ -64,6 +64,7 @@ DEFINE_uint64(thread, 1, "# worker threads."); // NOLINT DEFINE_string(transaction_type, "short", "type of transaction."); // NOLINT DEFINE_uint64(val_length, 4, "# length of value(payload)."); // NOLINT DEFINE_uint64(random_seed, 0, "random seed."); +DEFINE_uint64(epoch_time, 0, "epoch duration in us"); static bool isReady(const std::vector& readys); // NOLINT static void waitForReady(const std::vector& readys); @@ -204,6 +205,12 @@ static void load_flags() { printf("FLAGS_random_seed : (unset)\n"); // NOLINT } + if (!gflags::GetCommandLineFlagInfoOrDie("epoch_time").is_default) { + printf("FLAGS_epoch_time : %zu\n", FLAGS_epoch_time); // NOLINT + } else { + printf("FLAGS_epoch_time : (unset)\n"); // NOLINT + } + printf("Fin load_flags()\n"); // NOLINT } @@ -215,7 +222,12 @@ int main(int argc, char* argv[]) try { // NOLINT FLAGS_stderrthreshold = 0; // to display info log load_flags(); - init(); // NOLINT + database_options opt{}; + if (!gflags::GetCommandLineFlagInfoOrDie("epoch_time").is_default) { + opt.set_epoch_time(FLAGS_epoch_time); + } + + init(opt); // NOLINT LOG(INFO) << "start build_db"; build_db(FLAGS_record, FLAGS_key_length, FLAGS_val_length, FLAGS_thread); LOG(INFO) << "start invoke_leader";