comparison src/share/vm/gc_implementation/parNew/parNewGeneration.hpp @ 1710:94251661de76

6970376: ParNew: shared TaskQueue statistics Reviewed-by: ysr
author jcoomes
date Mon, 09 Aug 2010 18:03:50 -0700
parents a93a9eda13f7
children 8b10f48633dc
comparison
equal deleted inserted replaced
1709:5f429ee79634 1710:94251661de76
34 // in genOopClosures.inline.hpp. 34 // in genOopClosures.inline.hpp.
35 35
36 typedef Padded<OopTaskQueue> ObjToScanQueue; 36 typedef Padded<OopTaskQueue> ObjToScanQueue;
37 typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet; 37 typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet;
38 38
39 // Enable this to get push/pop/steal stats.
40 const int PAR_STATS_ENABLED = 0;
41
42 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure { 39 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
43 private: 40 private:
44 ParScanWeakRefClosure* _par_cl; 41 ParScanWeakRefClosure* _par_cl;
45 protected: 42 protected:
46 template <class T> void do_oop_work(T* p); 43 template <class T> void do_oop_work(T* p);
92 int _thread_num; 89 int _thread_num;
93 ageTable _ageTable; 90 ageTable _ageTable;
94 91
95 bool _to_space_full; 92 bool _to_space_full;
96 93
97 int _pushes, _pops, _steals, _steal_attempts, _term_attempts; 94 #if TASKQUEUE_STATS
98 int _overflow_pushes, _overflow_refills, _overflow_refill_objs; 95 size_t _term_attempts;
96 size_t _overflow_refills;
97 size_t _overflow_refill_objs;
98 #endif // TASKQUEUE_STATS
99 99
100 // Stats for promotion failure 100 // Stats for promotion failure
101 size_t _promotion_failure_size; 101 size_t _promotion_failure_size;
102 102
103 // Timing numbers. 103 // Timing numbers.
179 _promotion_failure_size = sz; 179 _promotion_failure_size = sz;
180 } 180 }
181 } 181 }
182 void print_and_clear_promotion_failure_size(); 182 void print_and_clear_promotion_failure_size();
183 183
184 int pushes() { return _pushes; } 184 #if TASKQUEUE_STATS
185 int pops() { return _pops; } 185 TaskQueueStats & taskqueue_stats() const { return _work_queue->stats; }
186 int steals() { return _steals; } 186
187 int steal_attempts() { return _steal_attempts; } 187 size_t term_attempts() const { return _term_attempts; }
188 int term_attempts() { return _term_attempts; } 188 size_t overflow_refills() const { return _overflow_refills; }
189 int overflow_pushes() { return _overflow_pushes; } 189 size_t overflow_refill_objs() const { return _overflow_refill_objs; }
190 int overflow_refills() { return _overflow_refills; } 190
191 int overflow_refill_objs() { return _overflow_refill_objs; } 191 void note_term_attempt() { ++_term_attempts; }
192 192 void note_overflow_refill(size_t objs) {
193 void note_push() { if (PAR_STATS_ENABLED) _pushes++; } 193 ++_overflow_refills; _overflow_refill_objs += objs;
194 void note_pop() { if (PAR_STATS_ENABLED) _pops++; } 194 }
195 void note_steal() { if (PAR_STATS_ENABLED) _steals++; } 195
196 void note_steal_attempt() { if (PAR_STATS_ENABLED) _steal_attempts++; } 196 void reset_stats();
197 void note_term_attempt() { if (PAR_STATS_ENABLED) _term_attempts++; } 197 #endif // TASKQUEUE_STATS
198 void note_overflow_push() { if (PAR_STATS_ENABLED) _overflow_pushes++; }
199 void note_overflow_refill(int objs) {
200 if (PAR_STATS_ENABLED) {
201 _overflow_refills++;
202 _overflow_refill_objs += objs;
203 }
204 }
205 198
206 void start_strong_roots() { 199 void start_strong_roots() {
207 _start_strong_roots = os::elapsedTime(); 200 _start_strong_roots = os::elapsedTime();
208 } 201 }
209 void end_strong_roots() { 202 void end_strong_roots() {
210 _strong_roots_time += (os::elapsedTime() - _start_strong_roots); 203 _strong_roots_time += (os::elapsedTime() - _start_strong_roots);
211 } 204 }
212 double strong_roots_time() { return _strong_roots_time; } 205 double strong_roots_time() const { return _strong_roots_time; }
213 void start_term_time() { 206 void start_term_time() {
214 note_term_attempt(); 207 TASKQUEUE_STATS_ONLY(note_term_attempt());
215 _start_term = os::elapsedTime(); 208 _start_term = os::elapsedTime();
216 } 209 }
217 void end_term_time() { 210 void end_term_time() {
218 _term_time += (os::elapsedTime() - _start_term); 211 _term_time += (os::elapsedTime() - _start_term);
219 } 212 }
220 double term_time() { return _term_time; } 213 double term_time() const { return _term_time; }
221 214
222 double elapsed() { 215 double elapsed_time() const {
223 return os::elapsedTime() - _start; 216 return os::elapsedTime() - _start;
224 } 217 }
225 }; 218 };
226 219
227 class ParNewGenTask: public AbstractGangTask { 220 class ParNewGenTask: public AbstractGangTask {