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
This commit is contained in:
Andrew Kryczka 2017-10-16 18:29:50 -07:00 committed by Facebook Github Bot
parent 60c09f5fbb
commit 731895214b
3 changed files with 7 additions and 0 deletions

View File

@ -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<int64_t>(inserter.GetBytesInserted()));
}
// Verifies consistency of data after RandomTransaction() has been run.

View File

@ -132,6 +132,7 @@ bool RandomTransactionInserter::DoInsert(DB* db, Transaction* txn,
} else {
batch.Put(key, sum);
}
bytes_inserted_ += key.size() + sum.size();
}
}

View File

@ -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_;