< prev index next >

src/hotspot/share/utilities/numberSeq.hpp

Print this page
rev 59703 : imported patch 8238687-investigate-memory-uncommit-during-young-gc

@@ -45,11 +45,11 @@
 class AbsSeq: public CHeapObj<mtInternal> {
 private:
   void init(double alpha);
 
 protected:
-  int    _num; // the number of elements in the sequence
+  uint   _num; // the number of elements in the sequence
   double _sum; // the sum of the elements in the sequence
   double _sum_of_squares; // the sum of squares of the elements in the sequence
 
   double _davg; // decaying average
   double _dvariance; // decaying variance

@@ -60,17 +60,18 @@
   virtual double total() const { return (double) _num; };
 
 public:
   AbsSeq(double alpha = DEFAULT_ALPHA_VALUE);
 
+  virtual void reset();
   virtual void add(double val); // adds a new element to the sequence
   void add(unsigned val) { add((double) val); }
   virtual double maximum() const = 0; // maximum element in the sequence
   virtual double last() const = 0; // last element added in the sequence
 
   // the number of elements in the sequence
-  int num() const { return _num; }
+  uint num() const { return _num; }
   // the sum of the elements in the sequence
   double sum() const { return _sum; }
 
   double avg() const; // the average of the sequence
   double variance() const; // the variance of the sequence

@@ -110,25 +111,27 @@
     DefaultSeqLength = 10
   };
   void init();
 protected:
   double *_sequence; // buffers the last L elements in the sequence
-  int     _length; // this is L
+  uint    _length; // this is L
   int     _next;   // oldest slot in the array, i.e. next to be overwritten
 
 public:
   // accepts a value for L
-  TruncatedSeq(int length = DefaultSeqLength,
+  TruncatedSeq(uint length = DefaultSeqLength,
                double alpha = DEFAULT_ALPHA_VALUE);
   ~TruncatedSeq();
   virtual void add(double val);
   virtual double maximum() const;
   virtual double last() const; // the last value added to the sequence
 
   double oldest() const; // the oldest valid value in the sequence
   double predict_next() const; // prediction based on linear regression
 
+  virtual void reset();
+  bool is_full() const { return _length == _num; }
   // Debugging/Printing
   virtual void dump_on(outputStream* s);
 };
 
 #endif // SHARE_UTILITIES_NUMBERSEQ_HPP
< prev index next >