If a sample V, which has a square(V) = V * V, was seen N times, then
its sum of squares is given by N * square(V).
Change-Id: Ie3fe0e4afe6e79ba4c8a5a56532f9346f79b4029
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25184
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
void
sample(Counter val, int number)
{
- Counter value = val * number;
- sum += value;
- squares += value * value;
+ sum += val * number;
+ squares += val * val * number;
samples += number;
}
void
sample(Counter val, int number)
{
- Counter value = val * number;
- sum += value;
- squares += value * value;
+ sum += val * number;
+ squares += val * val * number;
}
/**