summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2007-05-11 11:47:18 -0700
committerNathan Binkert <binkertn@umich.edu>2007-05-11 11:47:18 -0700
commitd667ce01b488e505569d6dce253f97e4246851cf (patch)
treeda2256d965083fa6991ef8f8008e2a619e45bf9b /src/base
parent634d2e9d83054d2ddae4333d4e28e9a04cfbfd84 (diff)
downloadgem5-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/base')
-rw-r--r--src/base/statistics.hh20
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 {