From: Nilay Vaish Date: Fri, 6 Sep 2013 21:21:29 +0000 (-0500) Subject: stats: adds a Formula operator for division X-Git-Tag: stable_2014_02_15~146 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47d113696dd545933b818772f5e2cd7534947484;p=gem5.git stats: adds a Formula operator for division --- 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 >(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 * @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,