[RocksDB] Make Ticker Atomic

Summary:
Our ticker was not atomic. This was based on the assumption that we will increment counts at places only protected by Mutex. This is hard to program for and easy to make mistakes (mutex may be held a few layers above etc).
Also this increases the instructions executed when the mutex is held.

Test Plan: make check

Reviewers: haobo, dhruba

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D10569
main
Abhishek Kona 12 years ago
parent 85cccc5092
commit d98e56315d
  1. 4
      include/leveldb/statistics.h

@ -5,6 +5,7 @@
#ifndef STORAGE_LEVELDB_INCLUDE_STATISTICS_H_ #ifndef STORAGE_LEVELDB_INCLUDE_STATISTICS_H_
#define STORAGE_LEVELDB_INCLUDE_STATISTICS_H_ #define STORAGE_LEVELDB_INCLUDE_STATISTICS_H_
#include <atomic>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <string> #include <string>
@ -106,8 +107,7 @@ class Ticker {
} }
private: private:
uint64_t count_; std::atomic_uint_fast64_t count_;
}; };
// Analyze the performance of a db // Analyze the performance of a db

Loading…
Cancel
Save