Instrument memtable seeks

Summary: As title

Test Plan: compiles

Reviewers: sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D34191
This commit is contained in:
Igor Canadi 2015-02-27 17:06:06 -08:00
parent 216a9e16f4
commit 3cf7f353d9
3 changed files with 10 additions and 0 deletions

View File

@ -223,6 +223,8 @@ class MemTableIterator: public Iterator {
virtual bool Valid() const override { return valid_; }
virtual void Seek(const Slice& k) override {
PERF_TIMER_GUARD(seek_on_memtable_time);
PERF_COUNTER_ADD(seek_on_memtable_count, 1);
if (bloom_ != nullptr &&
!bloom_->MayContain(prefix_extractor_->Transform(ExtractUserKey(k)))) {
valid_ = false;

View File

@ -51,6 +51,10 @@ struct PerfContext {
// total time spent after Get() finds a key
uint64_t get_post_process_time;
uint64_t get_from_output_files_time; // total time reading from output files
// total time spent on seeking memtable
uint64_t seek_on_memtable_time;
// number of seeks issued on memtable
uint64_t seek_on_memtable_count;
// total time spent on seeking child iters
uint64_t seek_child_seek_time;
// number of seek issued in child iterators

View File

@ -44,6 +44,8 @@ void PerfContext::Reset() {
get_from_memtable_count = 0;
get_post_process_time = 0;
get_from_output_files_time = 0;
seek_on_memtable_time = 0;
seek_on_memtable_count = 0;
seek_child_seek_time = 0;
seek_child_seek_count = 0;
seek_min_heap_time = 0;
@ -78,6 +80,8 @@ std::string PerfContext::ToString() const {
<< OUTPUT(get_from_memtable_count)
<< OUTPUT(get_post_process_time)
<< OUTPUT(get_from_output_files_time)
<< OUTPUT(seek_on_memtable_time)
<< OUTPUT(seek_on_memtable_count)
<< OUTPUT(seek_child_seek_time)
<< OUTPUT(seek_child_seek_count)
<< OUTPUT(seek_min_heap_time)