summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-09-06 16:21:29 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2013-09-06 16:21:29 -0500
commit47d113696dd545933b818772f5e2cd7534947484 (patch)
treec31a6a1e8e2f92b869c6a98e6f73f49b6077318b /src/base
parentc0a8ad0a35cc273f494c9460277dcb13268baccc (diff)
downloadgem5-47d113696dd545933b818772f5e2cd7534947484.tar.xz
stats: adds a Formula operator for division
Diffstat (limited to 'src/base')
-rw-r--r--src/base/statistics.cc10
-rw-r--r--src/base/statistics.hh8
2 files changed, 18 insertions, 0 deletions
diff --git a/src/base/statistics.cc b/src/base/statistics.cc
index 630205a59..0b44a4ec7 100644
--- a/src/base/statistics.cc
+++ b/src/base/statistics.cc
@@ -387,6 +387,16 @@ Formula::operator+=(Temp r)
return *this;
}
+const Formula &
+Formula::operator/=(Temp r)
+{
+ assert (root);
+ root = NodePtr(new BinaryNode<std::divides<Result> >(root, r));
+
+ assert(size());
+ return *this;
+}
+
void
Formula::result(VResult &vec) const
{
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 3c1a55623..f3b6ae39f 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -2856,6 +2856,14 @@ class Formula : public DataWrapVec<Formula, FormulaInfoProxy>
* @return a reference to this formula.
*/
const Formula &operator+=(Temp r);
+
+ /**
+ * Divide the existing tree by the given one.
+ * @param r The root of the expression tree.
+ * @return a reference to this formula.
+ */
+ const Formula &operator/=(Temp r);
+
/**
* Return the result of the Fomula in a vector. If there were no Vector
* components to the Formula, then the vector is size 1. If there were,