Instrument memtable seeks

Summary: As title

Test Plan: compiles

Reviewers: sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D34191
main
Igor Canadi 10 years ago
parent 216a9e16f4
commit 3cf7f353d9
  1. 2
      db/memtable.cc
  2. 4
      include/rocksdb/perf_context.h
  3. 4
      util/perf_context.cc

@ -223,6 +223,8 @@ class MemTableIterator: public Iterator {
virtual bool Valid() const override { return valid_; } virtual bool Valid() const override { return valid_; }
virtual void Seek(const Slice& k) override { 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 && if (bloom_ != nullptr &&
!bloom_->MayContain(prefix_extractor_->Transform(ExtractUserKey(k)))) { !bloom_->MayContain(prefix_extractor_->Transform(ExtractUserKey(k)))) {
valid_ = false; valid_ = false;

@ -51,6 +51,10 @@ struct PerfContext {
// total time spent after Get() finds a key // total time spent after Get() finds a key
uint64_t get_post_process_time; uint64_t get_post_process_time;
uint64_t get_from_output_files_time; // total time reading from output files 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 // total time spent on seeking child iters
uint64_t seek_child_seek_time; uint64_t seek_child_seek_time;
// number of seek issued in child iterators // number of seek issued in child iterators

@ -44,6 +44,8 @@ void PerfContext::Reset() {
get_from_memtable_count = 0; get_from_memtable_count = 0;
get_post_process_time = 0; get_post_process_time = 0;
get_from_output_files_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_time = 0;
seek_child_seek_count = 0; seek_child_seek_count = 0;
seek_min_heap_time = 0; seek_min_heap_time = 0;
@ -78,6 +80,8 @@ std::string PerfContext::ToString() const {
<< OUTPUT(get_from_memtable_count) << OUTPUT(get_from_memtable_count)
<< OUTPUT(get_post_process_time) << OUTPUT(get_post_process_time)
<< OUTPUT(get_from_output_files_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_time)
<< OUTPUT(seek_child_seek_count) << OUTPUT(seek_child_seek_count)
<< OUTPUT(seek_min_heap_time) << OUTPUT(seek_min_heap_time)

Loading…
Cancel
Save