mirror of https://github.com/facebook/rocksdb.git
output perf_context in db_bench readrandom
Summary: Add helper function to print perf context data in db_bench if enabled. I didn't find any code that actually exports perf context data. Not sure if I missed anything Test Plan: ran db_bench Reviewers: haobo, sdong, igor Reviewed By: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D16575
This commit is contained in:
parent
64138b5d9c
commit
04298f8c33
|
@ -1994,7 +1994,12 @@ class Benchmark {
|
|||
char msg[100];
|
||||
snprintf(msg, sizeof(msg), "(%" PRIu64 " of %" PRIu64 " found)",
|
||||
found, reads_);
|
||||
|
||||
thread->stats.AddMessage(msg);
|
||||
|
||||
if (FLAGS_perf_level > 0) {
|
||||
thread->stats.AddMessage(perf_context.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
void PrefixScanRandom(ThreadState* thread) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define STORAGE_ROCKSDB_INCLUDE_PERF_CONTEXT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
|
@ -26,6 +27,8 @@ struct PerfContext {
|
|||
|
||||
void Reset(); // reset all performance counters to zero
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
uint64_t user_key_comparison_count; // total number of user key comparisons
|
||||
uint64_t block_cache_hit_count; // total number of block cache hits
|
||||
uint64_t block_read_count; // total number of block reads (with IO)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// LICENSE file in the root directory of this source tree. An additional grant
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
//
|
||||
|
||||
#include <sstream>
|
||||
#include "util/perf_context_imp.h"
|
||||
|
||||
namespace rocksdb {
|
||||
|
@ -38,6 +40,35 @@ void PerfContext::Reset() {
|
|||
write_memtable_time = 0;
|
||||
}
|
||||
|
||||
#define OUTPUT(counter) #counter << " = " << counter << ", "
|
||||
|
||||
std::string PerfContext::ToString() const {
|
||||
std::ostringstream ss;
|
||||
ss << OUTPUT(user_key_comparison_count)
|
||||
<< OUTPUT(block_cache_hit_count)
|
||||
<< OUTPUT(block_read_count)
|
||||
<< OUTPUT(block_read_byte)
|
||||
<< OUTPUT(block_read_time)
|
||||
<< OUTPUT(block_checksum_time)
|
||||
<< OUTPUT(block_decompress_time)
|
||||
<< OUTPUT(internal_key_skipped_count)
|
||||
<< OUTPUT(internal_delete_skipped_count)
|
||||
<< OUTPUT(write_wal_time)
|
||||
<< OUTPUT(get_snapshot_time)
|
||||
<< OUTPUT(get_from_memtable_time)
|
||||
<< OUTPUT(get_from_memtable_count)
|
||||
<< OUTPUT(get_post_process_time)
|
||||
<< OUTPUT(get_from_output_files_time)
|
||||
<< OUTPUT(seek_child_seek_time)
|
||||
<< OUTPUT(seek_child_seek_count)
|
||||
<< OUTPUT(seek_min_heap_time)
|
||||
<< OUTPUT(seek_internal_seek_time)
|
||||
<< OUTPUT(find_next_user_entry_time)
|
||||
<< OUTPUT(write_pre_and_post_process_time)
|
||||
<< OUTPUT(write_memtable_time);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
__thread PerfContext perf_context;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue