< prev index next >

src/share/vm/utilities/numberSeq.hpp

Print this page
rev 10729 : [backport] Move HdrSeq and BinaryMagnitudeSeq into Shenandoah utilities


  87 
  88 class NumberSeq: public AbsSeq {
  89 private:
  90   bool check_nums(NumberSeq* total, int n, NumberSeq** parts);
  91 
  92 protected:
  93   double _last;
  94   double _maximum; // keep track of maximum value
  95 
  96 public:
  97   NumberSeq(double alpha = DEFAULT_ALPHA_VALUE);
  98 
  99   virtual void add(double val);
 100   virtual double maximum() const { return _maximum; }
 101   virtual double last() const { return _last; }
 102 
 103   // Debugging/Printing
 104   virtual void dump_on(outputStream* s);
 105 };
 106 
 107 // HDR sequence stores the low-resolution high-dynamic-range values.
 108 // It does so by maintaining the double array, where first array defines
 109 // the magnitude of the value being stored, and the second array maintains
 110 // the low resolution histogram within that magnitude. For example, storing
 111 // 4.352819 * 10^3 increments the bucket _hdr[3][435]. This allows for
 112 // memory efficient storage of huge amount of samples.
 113 //
 114 // Accepts positive numbers only.
 115 class HdrSeq: public NumberSeq {
 116 private:
 117   enum PrivateConstants {
 118     ValBuckets = 512,
 119     MagBuckets = 24,
 120     MagMinimum = -12,
 121   };
 122   int** _hdr;
 123 
 124 public:
 125   HdrSeq();
 126   ~HdrSeq();
 127 
 128   virtual void add(double val);
 129   double percentile(double level) const;
 130 };
 131 
 132 // Binary magnitude sequence stores the power-of-two histogram.
 133 // It has very low memory requirements, and is thread-safe. When accuracy
 134 // is not needed, it is preferred over HdrSeq.
 135 class BinaryMagnitudeSeq {
 136 private:
 137   jlong  _sum;
 138   jlong* _mags;
 139 
 140 public:
 141   BinaryMagnitudeSeq();
 142   ~BinaryMagnitudeSeq();
 143 
 144   void add(size_t val);
 145   size_t num() const;
 146   size_t level(int level) const;
 147   size_t sum() const;
 148   int min_level() const;
 149   int max_level() const;
 150 };
 151 
 152 class TruncatedSeq: public AbsSeq {
 153 private:
 154   enum PrivateConstants {
 155     DefaultSeqLength = 10
 156   };
 157   void init();
 158 protected:
 159   double *_sequence; // buffers the last L elements in the sequence
 160   int     _length; // this is L
 161   int     _next;   // oldest slot in the array, i.e. next to be overwritten
 162 
 163 public:
 164   // accepts a value for L
 165   TruncatedSeq(int length = DefaultSeqLength,
 166                double alpha = DEFAULT_ALPHA_VALUE);
 167   ~TruncatedSeq();
 168   virtual void add(double val);
 169   virtual double maximum() const;
 170   virtual double last() const; // the last value added to the sequence
 171 


  87 
  88 class NumberSeq: public AbsSeq {
  89 private:
  90   bool check_nums(NumberSeq* total, int n, NumberSeq** parts);
  91 
  92 protected:
  93   double _last;
  94   double _maximum; // keep track of maximum value
  95 
  96 public:
  97   NumberSeq(double alpha = DEFAULT_ALPHA_VALUE);
  98 
  99   virtual void add(double val);
 100   virtual double maximum() const { return _maximum; }
 101   virtual double last() const { return _last; }
 102 
 103   // Debugging/Printing
 104   virtual void dump_on(outputStream* s);
 105 };
 106 













































 107 class TruncatedSeq: public AbsSeq {
 108 private:
 109   enum PrivateConstants {
 110     DefaultSeqLength = 10
 111   };
 112   void init();
 113 protected:
 114   double *_sequence; // buffers the last L elements in the sequence
 115   int     _length; // this is L
 116   int     _next;   // oldest slot in the array, i.e. next to be overwritten
 117 
 118 public:
 119   // accepts a value for L
 120   TruncatedSeq(int length = DefaultSeqLength,
 121                double alpha = DEFAULT_ALPHA_VALUE);
 122   ~TruncatedSeq();
 123   virtual void add(double val);
 124   virtual double maximum() const;
 125   virtual double last() const; // the last value added to the sequence
 126 
< prev index next >