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 <amnon@scylladb.com>
Message-Id: <1465231006-7081-1-git-send-email-amnon@scylladb.com>
This commit is contained in:
Amnon Heiman
2016-06-06 19:36:46 +03:00
committed by Pekka Enberg
parent ce08bc611c
commit 2cf882c365
Notes: Pekka Enberg 2016-06-07 09:44:26 +03:00
backport: 1.2

View File

@@ -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;