From 2cf882c365ebbb765da33ecd11c028bf9dc3a8ec Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Mon, 6 Jun 2016 19:36:46 +0300 Subject: [PATCH] rate_moving_average: mean_rate is not initilized The rate_moving_average is used by timed_rate_moving_average to return its internal values. If there are no timed event, the mean_rate is not propertly initilized. To solve that the mean_rate is now initilized to 0 in the structure definition. Refs #1306 Signed-off-by: Amnon Heiman Message-Id: <1465231006-7081-1-git-send-email-amnon@scylladb.com> --- utils/histogram.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/histogram.hh b/utils/histogram.hh index 52de414e90..76297a619f 100644 --- a/utils/histogram.hh +++ b/utils/histogram.hh @@ -197,7 +197,7 @@ inline ihistogram operator +(ihistogram a, const ihistogram& b) { struct rate_moving_average { uint64_t count = 0; double rates[3] = {0}; - double mean_rate; + double mean_rate = 0; rate_moving_average& operator +=(const rate_moving_average& o) { count += o.count; mean_rate += o.mean_rate;