From dd582d2733fc3a80f710e4f69f07c19a1ef37695 Mon Sep 17 00:00:00 2001 From: YaacovHazan <31382944+YaacovHazan@users.noreply.github.com> Date: Wed, 11 Dec 2019 12:46:30 +0200 Subject: [PATCH] fix issue #104 arbitrary command with run count (#105) when using the arbitrary command with run count, the format_arbitrary_command() called for each run, causing to the data to be corrupted. moving the function to be called once at main() --- memtier_benchmark.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/memtier_benchmark.cpp b/memtier_benchmark.cpp index eaae3a9e..2ee9bc74 100755 --- a/memtier_benchmark.cpp +++ b/memtier_benchmark.cpp @@ -1018,13 +1018,6 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj threads.push_back(t); } - // if user configure arbitrary commands, we use one of the thread's protocol to format and prepare it - for (unsigned int i=0; iarbitrary_commands->size(); i++) { - if (!threads.front()->m_protocol->format_arbitrary_command(cfg->arbitrary_commands->at(i))) { - exit(1); - } - } - // launch threads fprintf(stderr, "[RUN #%u] Launching threads now...\n", run_id); for (std::vector::iterator i = threads.begin(); i != threads.end(); i++) { @@ -1163,6 +1156,19 @@ int main(int argc, char *argv[]) fprintf(stderr, "===================================================\n"); } + // if user configure arbitrary commands, format and prepare it + for (unsigned int i=0; isize(); i++) { + abstract_protocol* tmp_protocol = protocol_factory(cfg.protocol); + assert(tmp_protocol != NULL); + + if (!tmp_protocol->format_arbitrary_command(cfg.arbitrary_commands->at(i))) { + exit(1); + } + + delete tmp_protocol; + } + + #ifdef USE_TLS // Initialize OpenSSL only if we're really going to use it. if (cfg.tls) {