libfoedus-core
FOEDUS Core Library
|
Implements a probabilistic counter [Morris 1978]. More...
Implements a probabilistic counter [Morris 1978].
The major user is HCC's temperature field maintained in each page header.
[Morris 1987] Robert Morris, Counting large numbers of events in small registers, Commun. ACM 21, 10 (October 1978), 840-842.
Unlike the paper, we do much simpler thing. We just compare with power of two, so that we don't need exp/log. No information stored in static/global whatever.
Definition at line 37 of file prob_counter.hpp.
#include <prob_counter.hpp>
Public Member Functions | |
ProbCounter () | |
void | reset () |
void | increment (UniformRandom *rnd) |
void | decrement_force () |
Public Attributes | |
uint8_t | value_ |
Log arithmic counter of aborts. More... | |
|
inline |
Definition at line 45 of file prob_counter.hpp.
References ASSERT_ND.
|
inline |
Definition at line 69 of file prob_counter.hpp.
References value_.
|
inline |
Definition at line 51 of file prob_counter.hpp.
References foedus::assorted::UniformRandom::next_uint32(), and value_.
Referenced by foedus::xct::RwLockableXctId::hotter().
|
inline |
Definition at line 49 of file prob_counter.hpp.
Referenced by foedus::storage::hash::HashStoragePimpl::hcc_reset_all_temperature_stat_data(), foedus::storage::array::ArrayStoragePimpl::hcc_reset_all_temperature_stat_intermediate(), foedus::storage::masstree::MasstreeStoragePimpl::hcc_reset_all_temperature_stat_recurse(), foedus::storage::PageHeader::init_snapshot(), and foedus::storage::PageHeader::init_volatile().
uint8_t foedus::assorted::ProbCounter::value_ |
Log arithmic counter of aborts.
There were about 2^value_ aborts. Keep it single member so sizeof(ProbCounter) == sizeof(uint8_t).
Definition at line 43 of file prob_counter.hpp.
Referenced by foedus::xct::RetrospectiveLockList::construct(), foedus::storage::PageHeader::contains_hot_records(), decrement_force(), increment(), foedus::thread::Thread::is_hot_page(), and foedus::storage::operator<<().