29 #include "gc/shared/workerDataArray.hpp"
30 #include "memory/referenceType.hpp"
31 #include "utilities/ticks.hpp"
32
33 class DiscoveredList;
34 class GCTimer;
35
36 class ReferenceProcessorPhaseTimes : public CHeapObj<mtGC> {
37 public:
38 // Detailed phases that has parallel work.
39 enum RefProcParPhases {
40 SoftRefPhase1,
41 SoftRefPhase2,
42 SoftRefPhase3,
43 WeakRefPhase2,
44 WeakRefPhase3,
45 FinalRefPhase2,
46 FinalRefPhase3,
47 PhantomRefPhase2,
48 PhantomRefPhase3,
49 RefEnqueue,
50 RefParPhaseMax
51 };
52
53 // Sub-phases that are used when processing each j.l.Reference types.
54 // Only SoftReference has RefPhase1.
55 enum RefProcPhaseNumbers {
56 RefPhase1,
57 RefPhase2,
58 RefPhase3,
59 RefPhaseMax
60 };
61
62 private:
63 static const int number_of_subclasses_of_ref = REF_PHANTOM - REF_OTHER; // 5 - 1 = 4
64
65 // Records per thread information of each phase.
66 WorkerDataArray<double>* _worker_time_sec[RefParPhaseMax];
67 // Records elapsed time of each phase.
68 double _par_phase_time_ms[RefParPhaseMax];
69
116 void set_ref_cleared(ReferenceType ref_type, size_t count);
117 size_t ref_discovered(ReferenceType ref_type) const;
118 void set_ref_discovered(ReferenceType ref_type, size_t count);
119 void set_ref_enqueued(ReferenceType ref_type, size_t count);
120
121 void set_balance_queues_time_ms(ReferenceType ref_type, double time_ms);
122
123 void set_processing_is_mt(bool processing_is_mt) { _processing_is_mt = processing_is_mt; }
124
125 ReferenceType processing_ref_type() const { return _processing_ref_type; }
126 void set_processing_ref_type(ReferenceType processing_ref_type) { _processing_ref_type = processing_ref_type; }
127
128 // Returns RefProcParPhases calculated from phase_number and _processing_ref_type.
129 RefProcParPhases par_phase(RefProcPhaseNumbers phase_number) const;
130
131 GCTimer* gc_timer() const { return _gc_timer; }
132
133 // Reset all fields. If not reset at next cycle, an assertion will fail.
134 void reset();
135
136 void print_enqueue_phase(uint base_indent = 0, bool print_total = true) const;
137 void print_all_references(uint base_indent = 0, bool print_total = true) const;
138 };
139
140 // Updates working time of each worker thread.
141 class RefProcWorkerTimeTracker : public StackObj {
142 protected:
143 WorkerDataArray<double>* _worker_time;
144 double _start_time;
145 uint _worker_id;
146
147 public:
148 RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers number,
149 ReferenceProcessorPhaseTimes* phase_times,
150 uint worker_id);
151 RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcParPhases phase,
152 ReferenceProcessorPhaseTimes* phase_times,
153 uint worker_id);
154 ~RefProcWorkerTimeTracker();
155 };
156
184 // Updates phase time at ReferenceProcessorPhaseTimes and save it into GCTimer.
185 class RefProcParPhaseTimeTracker : public RefProcPhaseTimeBaseTracker {
186 ReferenceProcessorPhaseTimes::RefProcPhaseNumbers _phase_number;
187
188 public:
189 RefProcParPhaseTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers phase_number,
190 ReferenceProcessorPhaseTimes* phase_times);
191 ~RefProcParPhaseTimeTracker();
192 };
193
194 // Updates phase time related information.
195 // - Each phase processing time, cleared/discovered reference counts and stats for each working threads if MT processed.
196 class RefProcPhaseTimesTracker : public RefProcPhaseTimeBaseTracker {
197 ReferenceProcessor* _rp;
198
199 public:
200 RefProcPhaseTimesTracker(ReferenceType ref_type,
201 ReferenceProcessorPhaseTimes* phase_times,
202 ReferenceProcessor* rp);
203 ~RefProcPhaseTimesTracker();
204 };
205
206 // Updates enqueue time related information.
207 // - Enqueueing time, enqueued reference count and stats for each working thread if MT processed.
208 class RefProcEnqueueTimeTracker : public RefProcPhaseTimeBaseTracker {
209 public:
210 RefProcEnqueueTimeTracker(ReferenceProcessorPhaseTimes* phase_times,
211 ReferenceProcessorStats& stats);
212 ~RefProcEnqueueTimeTracker();
213 };
214
215 #endif // SHARE_VM_GC_SHARED_REFERENCEPROCESSORPHASETIMES_HPP
|
29 #include "gc/shared/workerDataArray.hpp"
30 #include "memory/referenceType.hpp"
31 #include "utilities/ticks.hpp"
32
33 class DiscoveredList;
34 class GCTimer;
35
36 class ReferenceProcessorPhaseTimes : public CHeapObj<mtGC> {
37 public:
38 // Detailed phases that has parallel work.
39 enum RefProcParPhases {
40 SoftRefPhase1,
41 SoftRefPhase2,
42 SoftRefPhase3,
43 WeakRefPhase2,
44 WeakRefPhase3,
45 FinalRefPhase2,
46 FinalRefPhase3,
47 PhantomRefPhase2,
48 PhantomRefPhase3,
49 RefParPhaseMax
50 };
51
52 // Sub-phases that are used when processing each j.l.Reference types.
53 // Only SoftReference has RefPhase1.
54 enum RefProcPhaseNumbers {
55 RefPhase1,
56 RefPhase2,
57 RefPhase3,
58 RefPhaseMax
59 };
60
61 private:
62 static const int number_of_subclasses_of_ref = REF_PHANTOM - REF_OTHER; // 5 - 1 = 4
63
64 // Records per thread information of each phase.
65 WorkerDataArray<double>* _worker_time_sec[RefParPhaseMax];
66 // Records elapsed time of each phase.
67 double _par_phase_time_ms[RefParPhaseMax];
68
115 void set_ref_cleared(ReferenceType ref_type, size_t count);
116 size_t ref_discovered(ReferenceType ref_type) const;
117 void set_ref_discovered(ReferenceType ref_type, size_t count);
118 void set_ref_enqueued(ReferenceType ref_type, size_t count);
119
120 void set_balance_queues_time_ms(ReferenceType ref_type, double time_ms);
121
122 void set_processing_is_mt(bool processing_is_mt) { _processing_is_mt = processing_is_mt; }
123
124 ReferenceType processing_ref_type() const { return _processing_ref_type; }
125 void set_processing_ref_type(ReferenceType processing_ref_type) { _processing_ref_type = processing_ref_type; }
126
127 // Returns RefProcParPhases calculated from phase_number and _processing_ref_type.
128 RefProcParPhases par_phase(RefProcPhaseNumbers phase_number) const;
129
130 GCTimer* gc_timer() const { return _gc_timer; }
131
132 // Reset all fields. If not reset at next cycle, an assertion will fail.
133 void reset();
134
135 void print_all_references(uint base_indent = 0, bool print_total = true) const;
136 };
137
138 // Updates working time of each worker thread.
139 class RefProcWorkerTimeTracker : public StackObj {
140 protected:
141 WorkerDataArray<double>* _worker_time;
142 double _start_time;
143 uint _worker_id;
144
145 public:
146 RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers number,
147 ReferenceProcessorPhaseTimes* phase_times,
148 uint worker_id);
149 RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcParPhases phase,
150 ReferenceProcessorPhaseTimes* phase_times,
151 uint worker_id);
152 ~RefProcWorkerTimeTracker();
153 };
154
182 // Updates phase time at ReferenceProcessorPhaseTimes and save it into GCTimer.
183 class RefProcParPhaseTimeTracker : public RefProcPhaseTimeBaseTracker {
184 ReferenceProcessorPhaseTimes::RefProcPhaseNumbers _phase_number;
185
186 public:
187 RefProcParPhaseTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers phase_number,
188 ReferenceProcessorPhaseTimes* phase_times);
189 ~RefProcParPhaseTimeTracker();
190 };
191
192 // Updates phase time related information.
193 // - Each phase processing time, cleared/discovered reference counts and stats for each working threads if MT processed.
194 class RefProcPhaseTimesTracker : public RefProcPhaseTimeBaseTracker {
195 ReferenceProcessor* _rp;
196
197 public:
198 RefProcPhaseTimesTracker(ReferenceType ref_type,
199 ReferenceProcessorPhaseTimes* phase_times,
200 ReferenceProcessor* rp);
201 ~RefProcPhaseTimesTracker();
202 };
203
204 #endif // SHARE_VM_GC_SHARED_REFERENCEPROCESSORPHASETIMES_HPP
|