25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "gc/g1/g1CollectedHeap.inline.hpp" |
26 #include "gc/g1/g1CollectedHeap.inline.hpp" |
27 #include "gc/g1/g1ConcurrentRefine.hpp" |
27 #include "gc/g1/g1ConcurrentRefine.hpp" |
28 #include "gc/g1/g1ConcurrentRefineThread.hpp" |
28 #include "gc/g1/g1ConcurrentRefineThread.hpp" |
29 #include "gc/g1/g1DirtyCardQueue.hpp" |
29 #include "gc/g1/g1DirtyCardQueue.hpp" |
|
30 #include "gc/g1/g1Policy.hpp" |
30 #include "gc/g1/g1RemSet.hpp" |
31 #include "gc/g1/g1RemSet.hpp" |
31 #include "gc/g1/g1RemSetSummary.hpp" |
32 #include "gc/g1/g1RemSetSummary.hpp" |
32 #include "gc/g1/g1YoungRemSetSamplingThread.hpp" |
33 #include "gc/g1/g1YoungRemSetSamplingThread.hpp" |
33 #include "gc/g1/heapRegion.hpp" |
34 #include "gc/g1/heapRegion.hpp" |
34 #include "gc/g1/heapRegionRemSet.hpp" |
35 #include "gc/g1/heapRegionRemSet.hpp" |
51 _counter++; |
52 _counter++; |
52 } |
53 } |
53 }; |
54 }; |
54 |
55 |
55 void G1RemSetSummary::update() { |
56 void G1RemSetSummary::update() { |
56 _num_conc_refined_cards = _rem_set->num_conc_refined_cards(); |
57 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
57 G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set(); |
58 |
58 _num_processed_buf_mutator = dcqs.processed_buffers_mut(); |
59 const G1Policy* policy = g1h->policy(); |
59 _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread(); |
60 _total_mutator_refined_cards = policy->total_mutator_refined_cards(); |
|
61 _total_concurrent_refined_cards = policy->total_concurrent_refined_cards(); |
60 |
62 |
61 _num_coarsenings = HeapRegionRemSet::n_coarsenings(); |
63 _num_coarsenings = HeapRegionRemSet::n_coarsenings(); |
62 |
64 |
63 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
|
64 G1ConcurrentRefine* cg1r = g1h->concurrent_refine(); |
|
65 if (_rs_threads_vtimes != NULL) { |
65 if (_rs_threads_vtimes != NULL) { |
66 GetRSThreadVTimeClosure p(this); |
66 GetRSThreadVTimeClosure p(this); |
67 cg1r->threads_do(&p); |
67 g1h->concurrent_refine()->threads_do(&p); |
68 } |
68 } |
69 set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum()); |
69 set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum()); |
70 } |
70 } |
71 |
71 |
72 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) { |
72 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) { |
81 return _rs_threads_vtimes[thread]; |
81 return _rs_threads_vtimes[thread]; |
82 } |
82 } |
83 |
83 |
84 G1RemSetSummary::G1RemSetSummary() : |
84 G1RemSetSummary::G1RemSetSummary() : |
85 _rem_set(NULL), |
85 _rem_set(NULL), |
86 _num_conc_refined_cards(0), |
86 _total_mutator_refined_cards(0), |
87 _num_processed_buf_mutator(0), |
87 _total_concurrent_refined_cards(0), |
88 _num_processed_buf_rs_threads(0), |
|
89 _num_coarsenings(0), |
88 _num_coarsenings(0), |
90 _num_vtimes(G1ConcurrentRefine::max_num_threads()), |
89 _num_vtimes(G1ConcurrentRefine::max_num_threads()), |
91 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)), |
90 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)), |
92 _sampling_thread_vtime(0.0f) { |
91 _sampling_thread_vtime(0.0f) { |
93 |
92 |
94 memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes); |
93 memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes); |
95 } |
94 } |
96 |
95 |
97 G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) : |
96 G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) : |
98 _rem_set(rem_set), |
97 _rem_set(rem_set), |
99 _num_conc_refined_cards(0), |
98 _total_mutator_refined_cards(0), |
100 _num_processed_buf_mutator(0), |
99 _total_concurrent_refined_cards(0), |
101 _num_processed_buf_rs_threads(0), |
|
102 _num_coarsenings(0), |
100 _num_coarsenings(0), |
103 _num_vtimes(G1ConcurrentRefine::max_num_threads()), |
101 _num_vtimes(G1ConcurrentRefine::max_num_threads()), |
104 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)), |
102 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)), |
105 _sampling_thread_vtime(0.0f) { |
103 _sampling_thread_vtime(0.0f) { |
106 update(); |
104 update(); |
112 |
110 |
113 void G1RemSetSummary::set(G1RemSetSummary* other) { |
111 void G1RemSetSummary::set(G1RemSetSummary* other) { |
114 assert(other != NULL, "just checking"); |
112 assert(other != NULL, "just checking"); |
115 assert(_num_vtimes == other->_num_vtimes, "just checking"); |
113 assert(_num_vtimes == other->_num_vtimes, "just checking"); |
116 |
114 |
117 _num_conc_refined_cards = other->num_conc_refined_cards(); |
115 _total_mutator_refined_cards = other->total_mutator_refined_cards(); |
118 |
116 _total_concurrent_refined_cards = other->total_concurrent_refined_cards(); |
119 _num_processed_buf_mutator = other->num_processed_buf_mutator(); |
117 |
120 _num_processed_buf_rs_threads = other->num_processed_buf_rs_threads(); |
118 _num_coarsenings = other->num_coarsenings(); |
121 |
|
122 _num_coarsenings = other->_num_coarsenings; |
|
123 |
119 |
124 memcpy(_rs_threads_vtimes, other->_rs_threads_vtimes, sizeof(double) * _num_vtimes); |
120 memcpy(_rs_threads_vtimes, other->_rs_threads_vtimes, sizeof(double) * _num_vtimes); |
125 |
121 |
126 set_sampling_thread_vtime(other->sampling_thread_vtime()); |
122 set_sampling_thread_vtime(other->sampling_thread_vtime()); |
127 } |
123 } |
128 |
124 |
129 void G1RemSetSummary::subtract_from(G1RemSetSummary* other) { |
125 void G1RemSetSummary::subtract_from(G1RemSetSummary* other) { |
130 assert(other != NULL, "just checking"); |
126 assert(other != NULL, "just checking"); |
131 assert(_num_vtimes == other->_num_vtimes, "just checking"); |
127 assert(_num_vtimes == other->_num_vtimes, "just checking"); |
132 |
128 |
133 _num_conc_refined_cards = other->num_conc_refined_cards() - _num_conc_refined_cards; |
129 _total_mutator_refined_cards = other->total_mutator_refined_cards() - _total_mutator_refined_cards; |
134 |
130 _total_concurrent_refined_cards = other->total_concurrent_refined_cards() - _total_concurrent_refined_cards; |
135 _num_processed_buf_mutator = other->num_processed_buf_mutator() - _num_processed_buf_mutator; |
|
136 _num_processed_buf_rs_threads = other->num_processed_buf_rs_threads() - _num_processed_buf_rs_threads; |
|
137 |
131 |
138 _num_coarsenings = other->num_coarsenings() - _num_coarsenings; |
132 _num_coarsenings = other->num_coarsenings() - _num_coarsenings; |
139 |
133 |
140 for (uint i = 0; i < _num_vtimes; i++) { |
134 for (uint i = 0; i < _num_vtimes; i++) { |
141 set_rs_thread_vtime(i, other->rs_thread_vtime(i) - rs_thread_vtime(i)); |
135 set_rs_thread_vtime(i, other->rs_thread_vtime(i) - rs_thread_vtime(i)); |
354 } |
348 } |
355 }; |
349 }; |
356 |
350 |
357 void G1RemSetSummary::print_on(outputStream* out) { |
351 void G1RemSetSummary::print_on(outputStream* out) { |
358 out->print_cr(" Recent concurrent refinement statistics"); |
352 out->print_cr(" Recent concurrent refinement statistics"); |
359 out->print_cr(" Processed " SIZE_FORMAT " cards concurrently", num_conc_refined_cards()); |
353 out->print_cr(" Of " SIZE_FORMAT " refined cards:", total_refined_cards()); |
360 out->print_cr(" Of " SIZE_FORMAT " completed buffers:", num_processed_buf_total()); |
354 out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) by concurrent refinement threads.", |
361 out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) by concurrent RS threads.", |
355 total_concurrent_refined_cards(), |
362 num_processed_buf_total(), |
356 percent_of(total_concurrent_refined_cards(), total_refined_cards())); |
363 percent_of(num_processed_buf_rs_threads(), num_processed_buf_total())); |
|
364 out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) by mutator threads.", |
357 out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) by mutator threads.", |
365 num_processed_buf_mutator(), |
358 total_mutator_refined_cards(), |
366 percent_of(num_processed_buf_mutator(), num_processed_buf_total())); |
359 percent_of(total_mutator_refined_cards(), total_refined_cards())); |
367 out->print_cr(" Did " SIZE_FORMAT " coarsenings.", num_coarsenings()); |
360 out->print_cr(" Did " SIZE_FORMAT " coarsenings.", num_coarsenings()); |
368 out->print_cr(" Concurrent RS threads times (s)"); |
361 out->print_cr(" Concurrent refinement threads times (s)"); |
369 out->print(" "); |
362 out->print(" "); |
370 for (uint i = 0; i < _num_vtimes; i++) { |
363 for (uint i = 0; i < _num_vtimes; i++) { |
371 out->print(" %5.2f", rs_thread_vtime(i)); |
364 out->print(" %5.2f", rs_thread_vtime(i)); |
372 } |
365 } |
373 out->cr(); |
366 out->cr(); |