hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp

Print this page
rev 611 : Merge

@@ -1,10 +1,10 @@
 #ifdef USE_PRAGMA_IDENT_HDR
 #pragma ident "@(#)gcUtil.hpp   1.19 07/05/05 17:05:32 JVM"
 #endif
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -59,10 +59,16 @@
   // Input weight must be between 0 and 100
   AdaptiveWeightedAverage(unsigned weight) : 
     _average(0.0), _sample_count(0), _weight(weight), _last_sample(0.0) {
   }
 
+  void clear() {
+    _average = 0;
+    _sample_count = 0;
+    _last_sample = 0;
+  }
+
   // Accessors
   float    average() const       { return _average;       }
   unsigned weight()  const       { return _weight;        }
   unsigned count()   const       { return _sample_count;  }
   float    last_sample() const   { return _last_sample; }

@@ -116,10 +122,16 @@
   // Accessor
   float padded_average() const         { return _padded_avg; }
   float deviation()      const         { return _deviation;  }
   unsigned padding()     const         { return _padding;    }
 
+  void clear() {
+    AdaptiveWeightedAverage::clear();
+    _padded_avg = 0;
+    _deviation = 0;
+  }
+
   // Override
   void  sample(float new_sample);
 };
 
 // A weighted average that includes a deviation from the average,