src/share/vm/gc_implementation/shared/gcUtil.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/gc_implementation/shared/gcUtil.hpp Fri May 4 11:52:03 2012
--- new/src/share/vm/gc_implementation/shared/gcUtil.hpp Fri May 4 11:52:03 2012
*** 48,78 ****
--- 48,89 ----
float _average; // The last computed average
unsigned _sample_count; // How often we've sampled this average
unsigned _weight; // The weight used to smooth the averages
// A higher weight favors the most
// recent data.
+ bool _is_old; // Has enough historical data
+
+ const static unsigned OLD_THRESHOLD = 100;
protected:
float _last_sample; // The last value sampled.
! void increment_count() { _sample_count++; }
+ _sample_count++;
+ if (!_is_old && _sample_count > OLD_THRESHOLD) {
+ _is_old = true;
+ }
+ }
+
void set_average(float avg) { _average = avg; }
// Helper function, computes an adaptive weighted average
// given a sample and the last average
float compute_adaptive_average(float new_sample, float average);
public:
// Input weight must be between 0 and 100
AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) :
! _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) {
! _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0),
+ _is_old(false) {
}
void clear() {
_average = 0;
_sample_count = 0;
_last_sample = 0;
+ _is_old = false;
}
// Useful for modifying static structures after startup.
void modify(size_t avg, unsigned wt, bool force = false) {
assert(force, "Are you sure you want to call this?");
*** 83,92 ****
--- 94,104 ----
// Accessors
float average() const { return _average; }
unsigned weight() const { return _weight; }
unsigned count() const { return _sample_count; }
float last_sample() const { return _last_sample; }
+ bool is_old() const { return _is_old; }
// Update data with a new sample.
void sample(float new_sample);
static inline float exp_avg(float avg, float sample,
src/share/vm/gc_implementation/shared/gcUtil.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File