base: Fix squares of stats
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>
This commit is contained in:
committed by
Daniel Carvalho
parent
cc2732d5c3
commit
f5e84a5fb9
@@ -1724,9 +1724,8 @@ class SampleStor
|
||||
void
|
||||
sample(Counter val, int number)
|
||||
{
|
||||
Counter value = val * number;
|
||||
sum += value;
|
||||
squares += value * value;
|
||||
sum += val * number;
|
||||
squares += val * val * number;
|
||||
samples += number;
|
||||
}
|
||||
|
||||
@@ -1801,9 +1800,8 @@ class AvgSampleStor
|
||||
void
|
||||
sample(Counter val, int number)
|
||||
{
|
||||
Counter value = val * number;
|
||||
sum += value;
|
||||
squares += value * value;
|
||||
sum += val * number;
|
||||
squares += val * val * number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user