comparison src/share/vm/gc_implementation/shared/gcUtil.hpp @ 1145:e018e6884bd8

6631166: CMS: better heuristics when combatting fragmentation Summary: Autonomic per-worker free block cache sizing, tunable coalition policies, fixes to per-size block statistics, retuned gain and bandwidth of some feedback loop filters to allow quicker reactivity to abrupt changes in ambient demand, and other heuristics to reduce fragmentation of the CMS old gen. Also tightened some assertions, including those related to locking. Reviewed-by: jmasa
author ysr
date Wed, 23 Dec 2009 09:23:54 -0800
parents 9ee9cf798b59
children c18cbe5936b8
comparison
equal deleted inserted replaced
1111:44f61c24ddab 1145:e018e6884bd8
52 // given a sample and the last average 52 // given a sample and the last average
53 float compute_adaptive_average(float new_sample, float average); 53 float compute_adaptive_average(float new_sample, float average);
54 54
55 public: 55 public:
56 // Input weight must be between 0 and 100 56 // Input weight must be between 0 and 100
57 AdaptiveWeightedAverage(unsigned weight) : 57 AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) :
58 _average(0.0), _sample_count(0), _weight(weight), _last_sample(0.0) { 58 _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) {
59 } 59 }
60 60
61 void clear() { 61 void clear() {
62 _average = 0; 62 _average = 0;
63 _sample_count = 0; 63 _sample_count = 0;
64 _last_sample = 0; 64 _last_sample = 0;
65 }
66
67 // Useful for modifying static structures after startup.
68 void modify(size_t avg, unsigned wt, bool force = false) {
69 assert(force, "Are you sure you want to call this?");
70 _average = (float)avg;
71 _weight = wt;
65 } 72 }
66 73
67 // Accessors 74 // Accessors
68 float average() const { return _average; } 75 float average() const { return _average; }
69 unsigned weight() const { return _weight; } 76 unsigned weight() const { return _weight; }
81 static inline size_t exp_avg(size_t avg, size_t sample, 88 static inline size_t exp_avg(size_t avg, size_t sample,
82 unsigned int weight) { 89 unsigned int weight) {
83 // Convert to float and back to avoid integer overflow. 90 // Convert to float and back to avoid integer overflow.
84 return (size_t)exp_avg((float)avg, (float)sample, weight); 91 return (size_t)exp_avg((float)avg, (float)sample, weight);
85 } 92 }
93
94 // Printing
95 void print_on(outputStream* st) const;
96 void print() const;
86 }; 97 };
87 98
88 99
89 // A weighted average that includes a deviation from the average, 100 // A weighted average that includes a deviation from the average,
90 // some multiple of which is added to the average. 101 // some multiple of which is added to the average.
127 _deviation = 0; 138 _deviation = 0;
128 } 139 }
129 140
130 // Override 141 // Override
131 void sample(float new_sample); 142 void sample(float new_sample);
143
144 // Printing
145 void print_on(outputStream* st) const;
146 void print() const;
132 }; 147 };
133 148
134 // A weighted average that includes a deviation from the average, 149 // A weighted average that includes a deviation from the average,
135 // some multiple of which is added to the average. 150 // some multiple of which is added to the average.
136 // 151 //
144 public: 159 public:
145 AdaptivePaddedNoZeroDevAverage(unsigned weight, unsigned padding) : 160 AdaptivePaddedNoZeroDevAverage(unsigned weight, unsigned padding) :
146 AdaptivePaddedAverage(weight, padding) {} 161 AdaptivePaddedAverage(weight, padding) {}
147 // Override 162 // Override
148 void sample(float new_sample); 163 void sample(float new_sample);
149 }; 164
165 // Printing
166 void print_on(outputStream* st) const;
167 void print() const;
168 };
169
150 // Use a least squares fit to a set of data to generate a linear 170 // Use a least squares fit to a set of data to generate a linear
151 // equation. 171 // equation.
152 // y = intercept + slope * x 172 // y = intercept + slope * x
153 173
154 class LinearLeastSquareFit : public CHeapObj { 174 class LinearLeastSquareFit : public CHeapObj {