1.1 --- a/src/share/vm/gc_implementation/shared/gcUtil.hpp Wed Dec 16 15:12:51 2009 -0800 1.2 +++ b/src/share/vm/gc_implementation/shared/gcUtil.hpp Wed Dec 23 09:23:54 2009 -0800 1.3 @@ -54,8 +54,8 @@ 1.4 1.5 public: 1.6 // Input weight must be between 0 and 100 1.7 - AdaptiveWeightedAverage(unsigned weight) : 1.8 - _average(0.0), _sample_count(0), _weight(weight), _last_sample(0.0) { 1.9 + AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) : 1.10 + _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) { 1.11 } 1.12 1.13 void clear() { 1.14 @@ -64,6 +64,13 @@ 1.15 _last_sample = 0; 1.16 } 1.17 1.18 + // Useful for modifying static structures after startup. 1.19 + void modify(size_t avg, unsigned wt, bool force = false) { 1.20 + assert(force, "Are you sure you want to call this?"); 1.21 + _average = (float)avg; 1.22 + _weight = wt; 1.23 + } 1.24 + 1.25 // Accessors 1.26 float average() const { return _average; } 1.27 unsigned weight() const { return _weight; } 1.28 @@ -83,6 +90,10 @@ 1.29 // Convert to float and back to avoid integer overflow. 1.30 return (size_t)exp_avg((float)avg, (float)sample, weight); 1.31 } 1.32 + 1.33 + // Printing 1.34 + void print_on(outputStream* st) const; 1.35 + void print() const; 1.36 }; 1.37 1.38 1.39 @@ -129,6 +140,10 @@ 1.40 1.41 // Override 1.42 void sample(float new_sample); 1.43 + 1.44 + // Printing 1.45 + void print_on(outputStream* st) const; 1.46 + void print() const; 1.47 }; 1.48 1.49 // A weighted average that includes a deviation from the average, 1.50 @@ -146,7 +161,12 @@ 1.51 AdaptivePaddedAverage(weight, padding) {} 1.52 // Override 1.53 void sample(float new_sample); 1.54 + 1.55 + // Printing 1.56 + void print_on(outputStream* st) const; 1.57 + void print() const; 1.58 }; 1.59 + 1.60 // Use a least squares fit to a set of data to generate a linear 1.61 // equation. 1.62 // y = intercept + slope * x