< prev index next >

src/share/vm/gc/shared/gcUtil.hpp

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCUTIL_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCUTIL_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/timer.hpp"
  30 #include "utilities/debug.hpp"
  31 #include "utilities/globalDefinitions.hpp"
  32 #include "utilities/ostream.hpp"
  33 
  34 // Catch-all file for utility classes
  35 
  36 // A weighted average maintains a running, weighted average
  37 // of some float value (templates would be handy here if we
  38 // need different types).
  39 //
  40 // The average is adaptive in that we smooth it for the
  41 // initial samples; we don't use the weight until we have
  42 // enough samples for it to be meaningful.
  43 //
  44 // This serves as our best estimate of a future unknown.
  45 //
  46 class AdaptiveWeightedAverage : public CHeapObj<mtGC> {


 199   double _sum_xy;       // sum of all x * y.
 200   double _intercept;     // constant term
 201   double _slope;        // slope
 202   // The weighted averages are not currently used but perhaps should
 203   // be used to get decaying averages.
 204   AdaptiveWeightedAverage _mean_x; // weighted mean of independent variable
 205   AdaptiveWeightedAverage _mean_y; // weighted mean of dependent variable
 206 
 207  public:
 208   LinearLeastSquareFit(unsigned weight);
 209   void update(double x, double y);
 210   double y(double x);
 211   double slope() { return _slope; }
 212   // Methods to decide if a change in the dependent variable will
 213   // achieve a desired goal.  Note that these methods are not
 214   // complementary and both are needed.
 215   bool decrement_will_decrease();
 216   bool increment_will_decrease();
 217 };
 218 
 219 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCUTIL_HPP


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_SHARED_GCUTIL_HPP
  26 #define SHARE_VM_GC_SHARED_GCUTIL_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/timer.hpp"
  30 #include "utilities/debug.hpp"
  31 #include "utilities/globalDefinitions.hpp"
  32 #include "utilities/ostream.hpp"
  33 
  34 // Catch-all file for utility classes
  35 
  36 // A weighted average maintains a running, weighted average
  37 // of some float value (templates would be handy here if we
  38 // need different types).
  39 //
  40 // The average is adaptive in that we smooth it for the
  41 // initial samples; we don't use the weight until we have
  42 // enough samples for it to be meaningful.
  43 //
  44 // This serves as our best estimate of a future unknown.
  45 //
  46 class AdaptiveWeightedAverage : public CHeapObj<mtGC> {


 199   double _sum_xy;       // sum of all x * y.
 200   double _intercept;     // constant term
 201   double _slope;        // slope
 202   // The weighted averages are not currently used but perhaps should
 203   // be used to get decaying averages.
 204   AdaptiveWeightedAverage _mean_x; // weighted mean of independent variable
 205   AdaptiveWeightedAverage _mean_y; // weighted mean of dependent variable
 206 
 207  public:
 208   LinearLeastSquareFit(unsigned weight);
 209   void update(double x, double y);
 210   double y(double x);
 211   double slope() { return _slope; }
 212   // Methods to decide if a change in the dependent variable will
 213   // achieve a desired goal.  Note that these methods are not
 214   // complementary and both are needed.
 215   bool decrement_will_decrease();
 216   bool increment_will_decrease();
 217 };
 218 
 219 #endif // SHARE_VM_GC_SHARED_GCUTIL_HPP
< prev index next >