1 /*
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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.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 = G1BarrierSet::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 G1CollectedHeap* g1h = G1CollectedHeap::heap();
63 G1ConcurrentRefine* cg1r = g1h->concurrent_refine();
64 if (_rs_threads_vtimes != NULL) {
65 GetRSThreadVTimeClosure p(this);
66 cg1r->threads_do(&p);
67 }
68 set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum());
69 }
70
71 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
72 assert(_rs_threads_vtimes != NULL, "just checking");
73 assert(thread < _num_vtimes, "just checking");
74 _rs_threads_vtimes[thread] = value;
75 }
76
|
1 /*
2 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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/g1DirtyCardQueue.hpp"
30 #include "gc/g1/g1RemSet.hpp"
31 #include "gc/g1/g1RemSetSummary.hpp"
32 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
33 #include "gc/g1/heapRegion.hpp"
34 #include "gc/g1/heapRegionRemSet.hpp"
35 #include "memory/allocation.inline.hpp"
36 #include "runtime/thread.inline.hpp"
37
38 class GetRSThreadVTimeClosure : public ThreadClosure {
39 private:
40 G1RemSetSummary* _summary;
41 uint _counter;
42
43 public:
44 GetRSThreadVTimeClosure(G1RemSetSummary * summary) : ThreadClosure(), _summary(summary), _counter(0) {
45 assert(_summary != NULL, "just checking");
46 }
47
48 virtual void do_thread(Thread* t) {
49 G1ConcurrentRefineThread* crt = (G1ConcurrentRefineThread*) t;
50 _summary->set_rs_thread_vtime(_counter, crt->vtime_accum());
51 _counter++;
52 }
53 };
54
55 void G1RemSetSummary::update() {
56 _num_conc_refined_cards = _rem_set->num_conc_refined_cards();
57 G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
58 _num_processed_buf_mutator = dcqs.processed_buffers_mut();
59 _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
60
61 _num_coarsenings = HeapRegionRemSet::n_coarsenings();
62
63 G1CollectedHeap* g1h = G1CollectedHeap::heap();
64 G1ConcurrentRefine* cg1r = g1h->concurrent_refine();
65 if (_rs_threads_vtimes != NULL) {
66 GetRSThreadVTimeClosure p(this);
67 cg1r->threads_do(&p);
68 }
69 set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum());
70 }
71
72 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
73 assert(_rs_threads_vtimes != NULL, "just checking");
74 assert(thread < _num_vtimes, "just checking");
75 _rs_threads_vtimes[thread] = value;
76 }
77
|