< prev index next >

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

Print this page
rev 7793 : 8073315: Enable gcc -Wtype-limits and fix upcoming issues.


  86 
  87   // Useful for modifying static structures after startup.
  88   void  modify(size_t avg, unsigned wt, bool force = false)  {
  89     assert(force, "Are you sure you want to call this?");
  90     _average = (float)avg;
  91     _weight  = wt;
  92   }
  93 
  94   // Accessors
  95   float    average() const       { return _average;       }
  96   unsigned weight()  const       { return _weight;        }
  97   unsigned count()   const       { return _sample_count;  }
  98   float    last_sample() const   { return _last_sample;   }
  99   bool     is_old()  const       { return _is_old;        }
 100 
 101   // Update data with a new sample.
 102   void sample(float new_sample);
 103 
 104   static inline float exp_avg(float avg, float sample,
 105                                unsigned int weight) {
 106     assert(0 <= weight && weight <= 100, "weight must be a percent");
 107     return (100.0F - weight) * avg / 100.0F + weight * sample / 100.0F;
 108   }
 109   static inline size_t exp_avg(size_t avg, size_t sample,
 110                                unsigned int weight) {
 111     // Convert to float and back to avoid integer overflow.
 112     return (size_t)exp_avg((float)avg, (float)sample, weight);
 113   }
 114 
 115   // Printing
 116   void print_on(outputStream* st) const;
 117   void print() const;
 118 };
 119 
 120 
 121 // A weighted average that includes a deviation from the average,
 122 // some multiple of which is added to the average.
 123 //
 124 // This serves as our best estimate of an upper bound on a future
 125 // unknown.
 126 class AdaptivePaddedAverage : public AdaptiveWeightedAverage {




  86 
  87   // Useful for modifying static structures after startup.
  88   void  modify(size_t avg, unsigned wt, bool force = false)  {
  89     assert(force, "Are you sure you want to call this?");
  90     _average = (float)avg;
  91     _weight  = wt;
  92   }
  93 
  94   // Accessors
  95   float    average() const       { return _average;       }
  96   unsigned weight()  const       { return _weight;        }
  97   unsigned count()   const       { return _sample_count;  }
  98   float    last_sample() const   { return _last_sample;   }
  99   bool     is_old()  const       { return _is_old;        }
 100 
 101   // Update data with a new sample.
 102   void sample(float new_sample);
 103 
 104   static inline float exp_avg(float avg, float sample,
 105                                unsigned int weight) {
 106     assert(weight <= 100, "weight must be a percent");
 107     return (100.0F - weight) * avg / 100.0F + weight * sample / 100.0F;
 108   }
 109   static inline size_t exp_avg(size_t avg, size_t sample,
 110                                unsigned int weight) {
 111     // Convert to float and back to avoid integer overflow.
 112     return (size_t)exp_avg((float)avg, (float)sample, weight);
 113   }
 114 
 115   // Printing
 116   void print_on(outputStream* st) const;
 117   void print() const;
 118 };
 119 
 120 
 121 // A weighted average that includes a deviation from the average,
 122 // some multiple of which is added to the average.
 123 //
 124 // This serves as our best estimate of an upper bound on a future
 125 // unknown.
 126 class AdaptivePaddedAverage : public AdaptiveWeightedAverage {


< prev index next >