diff options
author | Nathan Binkert <binkertn@umich.edu> | 2007-05-11 11:47:18 -0700 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2007-05-11 11:47:18 -0700 |
commit | d667ce01b488e505569d6dce253f97e4246851cf (patch) | |
tree | da2256d965083fa6991ef8f8008e2a619e45bf9b /src | |
parent | 634d2e9d83054d2ddae4333d4e28e9a04cfbfd84 (diff) | |
download | gem5-d667ce01b488e505569d6dce253f97e4246851cf.tar.xz |
total should be the sum of the vector result of an operation,
not sum the operands and then apply the operation.
--HG--
extra : convert_revision : 06486e59b3dd9588b458ef45c341cc4f2554dc09
Diffstat (limited to 'src')
-rw-r--r-- | src/base/statistics.hh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 761b30c2b..8d3f53d4c 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -2094,9 +2094,13 @@ class UnaryNode : public Node return vresult; } - Result total() const { - Op op; - return op(l->total()); + Result total() const + { + const VResult &vec = this->result(); + Result total = 0; + for (int i = 0; i < size(); i++) + total += vec[i]; + return total; } virtual size_t size() const { return l->size(); } @@ -2149,9 +2153,13 @@ class BinaryNode : public Node return vresult; } - Result total() const { - Op op; - return op(l->total(), r->total()); + Result total() const + { + const VResult &vec = this->result(); + Result total = 0; + for (int i = 0; i < size(); i++) + total += vec[i]; + return total; } virtual size_t size() const { |