diff options
Diffstat (limited to 'util/histogram.cc')
-rw-r--r-- | util/histogram.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/util/histogram.cc b/util/histogram.cc index c5178ef..12ec3cf 100644 --- a/util/histogram.cc +++ b/util/histogram.cc @@ -55,6 +55,17 @@ void Histogram::Add(double value) { sum_squares_ += (value * value); } +void Histogram::Merge(const Histogram& other) { + if (other.min_ < min_) min_ = other.min_; + if (other.max_ > max_) max_ = other.max_; + num_ += other.num_; + sum_ += other.sum_; + sum_squares_ += other.sum_squares_; + for (int b = 0; b < kNumBuckets; b++) { + buckets_[b] += other.buckets_[b]; + } +} + double Histogram::Median() const { return Percentile(50.0); } |