21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "gc/g1/g1BarrierSet.hpp" |
26 #include "gc/g1/g1CollectedHeap.inline.hpp" |
27 #include "gc/g1/g1CollectedHeap.inline.hpp" |
27 #include "gc/g1/g1ConcurrentRefine.hpp" |
28 #include "gc/g1/g1ConcurrentRefine.hpp" |
28 #include "gc/g1/g1ConcurrentRefineThread.hpp" |
29 #include "gc/g1/g1ConcurrentRefineThread.hpp" |
29 #include "gc/g1/g1DirtyCardQueue.hpp" |
30 #include "gc/g1/g1DirtyCardQueue.hpp" |
30 #include "gc/g1/g1Policy.hpp" |
|
31 #include "gc/g1/g1RemSet.hpp" |
31 #include "gc/g1/g1RemSet.hpp" |
32 #include "gc/g1/g1RemSetSummary.hpp" |
32 #include "gc/g1/g1RemSetSummary.hpp" |
33 #include "gc/g1/g1YoungRemSetSamplingThread.hpp" |
33 #include "gc/g1/g1YoungRemSetSamplingThread.hpp" |
34 #include "gc/g1/heapRegion.hpp" |
34 #include "gc/g1/heapRegion.hpp" |
35 #include "gc/g1/heapRegionRemSet.hpp" |
35 #include "gc/g1/heapRegionRemSet.hpp" |
36 #include "memory/allocation.inline.hpp" |
36 #include "memory/allocation.inline.hpp" |
37 #include "runtime/thread.inline.hpp" |
37 #include "runtime/thread.inline.hpp" |
38 |
38 |
39 class GetRSThreadVTimeClosure : public ThreadClosure { |
|
40 private: |
|
41 G1RemSetSummary* _summary; |
|
42 uint _counter; |
|
43 |
|
44 public: |
|
45 GetRSThreadVTimeClosure(G1RemSetSummary * summary) : ThreadClosure(), _summary(summary), _counter(0) { |
|
46 assert(_summary != NULL, "just checking"); |
|
47 } |
|
48 |
|
49 virtual void do_thread(Thread* t) { |
|
50 G1ConcurrentRefineThread* crt = (G1ConcurrentRefineThread*) t; |
|
51 _summary->set_rs_thread_vtime(_counter, crt->vtime_accum()); |
|
52 _counter++; |
|
53 } |
|
54 }; |
|
55 |
|
56 void G1RemSetSummary::update() { |
39 void G1RemSetSummary::update() { |
|
40 class CollectData : public ThreadClosure { |
|
41 G1RemSetSummary* _summary; |
|
42 uint _counter; |
|
43 public: |
|
44 CollectData(G1RemSetSummary * summary) : _summary(summary), _counter(0) {} |
|
45 virtual void do_thread(Thread* t) { |
|
46 G1ConcurrentRefineThread* crt = static_cast<G1ConcurrentRefineThread*>(t); |
|
47 _summary->set_rs_thread_vtime(_counter, crt->vtime_accum()); |
|
48 _counter++; |
|
49 _summary->_total_concurrent_refined_cards += crt->total_refined_cards(); |
|
50 } |
|
51 } collector(this); |
57 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
52 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
58 |
53 g1h->concurrent_refine()->threads_do(&collector); |
59 const G1Policy* policy = g1h->policy(); |
54 _total_mutator_refined_cards = G1BarrierSet::dirty_card_queue_set().total_mutator_refined_cards(); |
60 _total_mutator_refined_cards = policy->total_mutator_refined_cards(); |
|
61 _total_concurrent_refined_cards = policy->total_concurrent_refined_cards(); |
|
62 |
|
63 _num_coarsenings = HeapRegionRemSet::n_coarsenings(); |
55 _num_coarsenings = HeapRegionRemSet::n_coarsenings(); |
64 |
56 |
65 if (_rs_threads_vtimes != NULL) { |
|
66 GetRSThreadVTimeClosure p(this); |
|
67 g1h->concurrent_refine()->threads_do(&p); |
|
68 } |
|
69 set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum()); |
57 set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum()); |
70 } |
58 } |
71 |
59 |
72 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) { |
60 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) { |
73 assert(_rs_threads_vtimes != NULL, "just checking"); |
61 assert(_rs_threads_vtimes != NULL, "just checking"); |