6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/concurrentG1Refine.hpp"
27 #include "gc/g1/concurrentG1RefineThread.hpp"
28 #include "gc/g1/g1CollectedHeap.inline.hpp"
29 #include "gc/g1/g1RemSet.inline.hpp"
30 #include "gc/g1/g1RemSetSummary.hpp"
31 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
32 #include "gc/g1/heapRegion.hpp"
33 #include "gc/g1/heapRegionRemSet.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "runtime/thread.inline.hpp"
36
37 class GetRSThreadVTimeClosure : public ThreadClosure {
38 private:
39 G1RemSetSummary* _summary;
40 uint _counter;
41
42 public:
43 GetRSThreadVTimeClosure(G1RemSetSummary * summary) : ThreadClosure(), _summary(summary), _counter(0) {
44 assert(_summary != NULL, "just checking");
45 }
46
47 virtual void do_thread(Thread* t) {
48 ConcurrentG1RefineThread* crt = (ConcurrentG1RefineThread*) t;
49 _summary->set_rs_thread_vtime(_counter, crt->vtime_accum());
50 _counter++;
51 }
52 };
53
54 void G1RemSetSummary::update() {
55 _num_conc_refined_cards = _rem_set->num_conc_refined_cards();
56 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
57 _num_processed_buf_mutator = dcqs.processed_buffers_mut();
58 _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
59
60 _num_coarsenings = HeapRegionRemSet::n_coarsenings();
61
62 ConcurrentG1Refine * cg1r = G1CollectedHeap::heap()->concurrent_g1_refine();
63 if (_rs_threads_vtimes != NULL) {
64 GetRSThreadVTimeClosure p(this);
65 cg1r->worker_threads_do(&p);
66 }
67 set_sampling_thread_vtime(cg1r->sampling_thread()->vtime_accum());
68 }
69
70 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
71 assert(_rs_threads_vtimes != NULL, "just checking");
72 assert(thread < _num_vtimes, "just checking");
73 _rs_threads_vtimes[thread] = value;
74 }
75
76 double G1RemSetSummary::rs_thread_vtime(uint thread) const {
77 assert(_rs_threads_vtimes != NULL, "just checking");
78 assert(thread < _num_vtimes, "just checking");
79 return _rs_threads_vtimes[thread];
80 }
81
82 G1RemSetSummary::G1RemSetSummary() :
83 _rem_set(NULL),
84 _num_conc_refined_cards(0),
85 _num_processed_buf_mutator(0),
86 _num_processed_buf_rs_threads(0),
87 _num_coarsenings(0),
88 _num_vtimes(ConcurrentG1Refine::thread_num()),
89 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
90 _sampling_thread_vtime(0.0f) {
91
92 memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
93 }
94
95 G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) :
96 _rem_set(rem_set),
97 _num_conc_refined_cards(0),
98 _num_processed_buf_mutator(0),
99 _num_processed_buf_rs_threads(0),
100 _num_coarsenings(0),
101 _num_vtimes(ConcurrentG1Refine::thread_num()),
102 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
103 _sampling_thread_vtime(0.0f) {
104 update();
105 }
106
107 G1RemSetSummary::~G1RemSetSummary() {
108 if (_rs_threads_vtimes) {
109 FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
110 }
111 }
112
113 void G1RemSetSummary::set(G1RemSetSummary* other) {
114 assert(other != NULL, "just checking");
115 assert(_num_vtimes == other->_num_vtimes, "just checking");
116
117 _num_conc_refined_cards = other->num_conc_refined_cards();
118
119 _num_processed_buf_mutator = other->num_processed_buf_mutator();
120 _num_processed_buf_rs_threads = other->num_processed_buf_rs_threads();
121
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1CollectedHeap.inline.hpp"
27 #include "gc/g1/g1ConcurrentRefine.hpp"
28 #include "gc/g1/g1ConcurrentRefineThread.hpp"
29 #include "gc/g1/g1RemSet.inline.hpp"
30 #include "gc/g1/g1RemSetSummary.hpp"
31 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
32 #include "gc/g1/heapRegion.hpp"
33 #include "gc/g1/heapRegionRemSet.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "runtime/thread.inline.hpp"
36
37 class GetRSThreadVTimeClosure : public ThreadClosure {
38 private:
39 G1RemSetSummary* _summary;
40 uint _counter;
41
42 public:
43 GetRSThreadVTimeClosure(G1RemSetSummary * summary) : ThreadClosure(), _summary(summary), _counter(0) {
44 assert(_summary != NULL, "just checking");
45 }
46
47 virtual void do_thread(Thread* t) {
48 G1ConcurrentRefineThread* crt = (G1ConcurrentRefineThread*) t;
49 _summary->set_rs_thread_vtime(_counter, crt->vtime_accum());
50 _counter++;
51 }
52 };
53
54 void G1RemSetSummary::update() {
55 _num_conc_refined_cards = _rem_set->num_conc_refined_cards();
56 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
57 _num_processed_buf_mutator = dcqs.processed_buffers_mut();
58 _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
59
60 _num_coarsenings = HeapRegionRemSet::n_coarsenings();
61
62 G1ConcurrentRefine * cr = G1CollectedHeap::heap()->concurrent_refine();
63 if (_rs_threads_vtimes != NULL) {
64 GetRSThreadVTimeClosure p(this);
65 cr->worker_threads_do(&p);
66 }
67 set_sampling_thread_vtime(cr->sampling_thread()->vtime_accum());
68 }
69
70 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
71 assert(_rs_threads_vtimes != NULL, "just checking");
72 assert(thread < _num_vtimes, "just checking");
73 _rs_threads_vtimes[thread] = value;
74 }
75
76 double G1RemSetSummary::rs_thread_vtime(uint thread) const {
77 assert(_rs_threads_vtimes != NULL, "just checking");
78 assert(thread < _num_vtimes, "just checking");
79 return _rs_threads_vtimes[thread];
80 }
81
82 G1RemSetSummary::G1RemSetSummary() :
83 _rem_set(NULL),
84 _num_conc_refined_cards(0),
85 _num_processed_buf_mutator(0),
86 _num_processed_buf_rs_threads(0),
87 _num_coarsenings(0),
88 _num_vtimes(G1ConcurrentRefine::thread_num()),
89 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
90 _sampling_thread_vtime(0.0f) {
91
92 memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
93 }
94
95 G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) :
96 _rem_set(rem_set),
97 _num_conc_refined_cards(0),
98 _num_processed_buf_mutator(0),
99 _num_processed_buf_rs_threads(0),
100 _num_coarsenings(0),
101 _num_vtimes(G1ConcurrentRefine::thread_num()),
102 _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
103 _sampling_thread_vtime(0.0f) {
104 update();
105 }
106
107 G1RemSetSummary::~G1RemSetSummary() {
108 if (_rs_threads_vtimes) {
109 FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
110 }
111 }
112
113 void G1RemSetSummary::set(G1RemSetSummary* other) {
114 assert(other != NULL, "just checking");
115 assert(_num_vtimes == other->_num_vtimes, "just checking");
116
117 _num_conc_refined_cards = other->num_conc_refined_cards();
118
119 _num_processed_buf_mutator = other->num_processed_buf_mutator();
120 _num_processed_buf_rs_threads = other->num_processed_buf_rs_threads();
121
|