From 731895214bb729f4b748c8051d2d4c81927ff47f Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Mon, 16 Oct 2017 18:29:50 -0700 Subject: [PATCH] db_bench randomtransaction print throughput Summary: print throughput in MB/s upon finishing randomtransaction benchmark Closes https://github.com/facebook/rocksdb/pull/3016 Differential Revision: D6070426 Pulled By: ajkr fbshipit-source-id: 69df43beed4c374a36d826e761ca3a83e1fdcbf5 --- tools/db_bench_tool.cc | 1 + util/transaction_test_util.cc | 1 + util/transaction_test_util.h | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 3fa45a693..c36596b95 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -4944,6 +4944,7 @@ void VerifyDBFromDB(std::string& truth_db_name) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { thread->stats.AddMessage(get_perf_context()->ToString()); } + thread->stats.AddBytes(static_cast(inserter.GetBytesInserted())); } // Verifies consistency of data after RandomTransaction() has been run. diff --git a/util/transaction_test_util.cc b/util/transaction_test_util.cc index 0d6948b08..d439cf202 100644 --- a/util/transaction_test_util.cc +++ b/util/transaction_test_util.cc @@ -132,6 +132,7 @@ bool RandomTransactionInserter::DoInsert(DB* db, Transaction* txn, } else { batch.Put(key, sum); } + bytes_inserted_ += key.size() + sum.size(); } } diff --git a/util/transaction_test_util.h b/util/transaction_test_util.h index 8805490fd..768fc5283 100644 --- a/util/transaction_test_util.h +++ b/util/transaction_test_util.h @@ -83,6 +83,9 @@ class RandomTransactionInserter { // write any data. uint64_t GetFailureCount() { return failure_count_; } + // Returns the sum of user keys/values Put() to the DB. + size_t GetBytesInserted() { return bytes_inserted_; } + private: // Input options Random64* rand_; @@ -97,6 +100,8 @@ class RandomTransactionInserter { // Number of failed insert batches attempted uint64_t failure_count_ = 0; + size_t bytes_inserted_ = 0; + // Status returned by most recent insert operation Status last_status_;