Merge pull request #1042 from SherlockNoMad/HistFix
Fix in HistogramWindowingImpl
This commit is contained in:
commit
fbea4dc660
@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
namespace rocksdb {
|
namespace rocksdb {
|
||||||
|
|
||||||
namespace {
|
|
||||||
const HistogramBucketMapper bucketMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
HistogramWindowingImpl::HistogramWindowingImpl() {
|
HistogramWindowingImpl::HistogramWindowingImpl() {
|
||||||
env_ = Env::Default();
|
env_ = Env::Default();
|
||||||
window_stats_.reset(new HistogramStat[num_windows_]);
|
window_stats_.reset(new HistogramStat[num_windows_]);
|
||||||
@ -36,8 +32,7 @@ HistogramWindowingImpl::HistogramWindowingImpl(
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistogramWindowingImpl::~HistogramWindowingImpl(){
|
HistogramWindowingImpl::~HistogramWindowingImpl() {
|
||||||
window_stats_.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramWindowingImpl::Clear() {
|
void HistogramWindowingImpl::Clear() {
|
||||||
@ -85,7 +80,7 @@ void HistogramWindowingImpl::Merge(const HistogramWindowingImpl& other) {
|
|||||||
uint64_t cur_window = current_window();
|
uint64_t cur_window = current_window();
|
||||||
uint64_t other_cur_window = other.current_window();
|
uint64_t other_cur_window = other.current_window();
|
||||||
// going backwards for alignment
|
// going backwards for alignment
|
||||||
for (unsigned int i = 0;
|
for (unsigned int i = 0;
|
||||||
i < std::min(num_windows_, other.num_windows_); i++) {
|
i < std::min(num_windows_, other.num_windows_); i++) {
|
||||||
uint64_t window_index =
|
uint64_t window_index =
|
||||||
(cur_window + num_windows_ - i) % num_windows_;
|
(cur_window + num_windows_ - i) % num_windows_;
|
||||||
@ -147,7 +142,7 @@ void HistogramWindowingImpl::SwapHistoryBucket() {
|
|||||||
last_swap_time_.store(env_->NowMicros(), std::memory_order_relaxed);
|
last_swap_time_.store(env_->NowMicros(), std::memory_order_relaxed);
|
||||||
|
|
||||||
uint64_t curr_window = current_window();
|
uint64_t curr_window = current_window();
|
||||||
uint64_t next_window = (curr_window == num_windows_ - 1) ?
|
uint64_t next_window = (curr_window == num_windows_ - 1) ?
|
||||||
0 : curr_window + 1;
|
0 : curr_window + 1;
|
||||||
|
|
||||||
// subtract next buckets from totals and swap to next buckets
|
// subtract next buckets from totals and swap to next buckets
|
||||||
@ -160,7 +155,7 @@ void HistogramWindowingImpl::SwapHistoryBucket() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stats_.min() == stats_to_drop.min()) {
|
if (stats_.min() == stats_to_drop.min()) {
|
||||||
uint64_t new_min = bucketMapper.LastValue();
|
uint64_t new_min = std::numeric_limits<uint64_t>::max();
|
||||||
for (unsigned int i = 0; i < num_windows_; i++) {
|
for (unsigned int i = 0; i < num_windows_; i++) {
|
||||||
if (i != next_window) {
|
if (i != next_window) {
|
||||||
uint64_t m = window_stats_[i].min();
|
uint64_t m = window_stats_[i].min();
|
||||||
|
Loading…
Reference in New Issue
Block a user