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 #ifndef SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
26 #define SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
27
28 #include "logging/logLevel.hpp"
29 #include "memory/allocation.hpp"
30 #include "utilities/macros.hpp"
31
32 class LineBuffer;
33
34 template <class T> class WorkerDataArray;
35
36 class G1GCPhaseTimes : public CHeapObj<mtGC> {
37 uint _max_gc_threads;
38 jlong _gc_start_counter;
39 double _gc_pause_time_ms;
40
41 public:
42 enum GCParPhases {
43 GCWorkerStart,
44 ExtRootScan,
45 ThreadRoots,
46 StringTableRoots,
47 UniverseRoots,
48 JNIRoots,
49 ObjectSynchronizerRoots,
50 FlatProfilerRoots,
51 ManagementRoots,
52 SystemDictionaryRoots,
134
135 double _recorded_preserve_cm_referents_time_ms;
136
137 double _recorded_merge_pss_time_ms;
138
139 double _recorded_start_new_cset_time_ms;
140
141 double _recorded_total_free_cset_time_ms;
142
143 double _recorded_serial_free_cset_time_ms;
144
145 double _cur_fast_reclaim_humongous_time_ms;
146 double _cur_fast_reclaim_humongous_register_time_ms;
147 size_t _cur_fast_reclaim_humongous_total;
148 size_t _cur_fast_reclaim_humongous_candidates;
149 size_t _cur_fast_reclaim_humongous_reclaimed;
150
151 double _cur_verify_before_time_ms;
152 double _cur_verify_after_time_ms;
153
154 double worker_time(GCParPhases phase, uint worker);
155 void note_gc_end();
156 void reset();
157
158 template <class T>
159 void details(T* phase, const char* indent) const;
160
161 void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const;
162 void debug_phase(WorkerDataArray<double>* phase) const;
163 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true) const;
164
165 void info_time(const char* name, double value) const;
166 void debug_time(const char* name, double value) const;
167 // This will print logs for both 'gc+phases' and 'gc+phases+ref'.
168 void debug_time_for_reference(const char* name, double value) const;
169 void trace_time(const char* name, double value) const;
170 void trace_count(const char* name, size_t value) const;
171
172 double print_pre_evacuate_collection_set() const;
173 double print_evacuate_collection_set() const;
174 double print_post_evacuate_collection_set() const;
175 void print_other(double accounted_ms) const;
176
177 public:
178 G1GCPhaseTimes(uint max_gc_threads);
179 void note_gc_start();
180 void print();
181
182 // record the time a phase took in seconds
183 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
184
185 // add a number of seconds to a phase
186 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
187
188 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
189
190 // return the average time for a phase in milliseconds
191 double average_time_ms(GCParPhases phase);
192
193 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
194
195 public:
196
197 void record_prepare_tlab_time_ms(double ms) {
198 _cur_prepare_tlab_time_ms = ms;
331
332 double root_region_scan_wait_time_ms() {
333 return _root_region_scan_wait_time_ms;
334 }
335
336 double young_cset_choice_time_ms() {
337 return _recorded_young_cset_choice_time_ms;
338 }
339
340 double total_free_cset_time_ms() {
341 return _recorded_total_free_cset_time_ms;
342 }
343
344 double non_young_cset_choice_time_ms() {
345 return _recorded_non_young_cset_choice_time_ms;
346 }
347
348 double fast_reclaim_humongous_time_ms() {
349 return _cur_fast_reclaim_humongous_time_ms;
350 }
351 };
352
353 class G1GCParPhaseTimesTracker : public StackObj {
354 double _start_time;
355 G1GCPhaseTimes::GCParPhases _phase;
356 G1GCPhaseTimes* _phase_times;
357 uint _worker_id;
358 public:
359 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
360 ~G1GCParPhaseTimesTracker();
361 };
362
363 #endif // SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
|
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 #ifndef SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
26 #define SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
27
28 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
29 #include "logging/logLevel.hpp"
30 #include "memory/allocation.hpp"
31 #include "utilities/macros.hpp"
32
33 class LineBuffer;
34 class STWGCTimer;
35
36 template <class T> class WorkerDataArray;
37
38 class G1GCPhaseTimes : public CHeapObj<mtGC> {
39 uint _max_gc_threads;
40 jlong _gc_start_counter;
41 double _gc_pause_time_ms;
42
43 public:
44 enum GCParPhases {
45 GCWorkerStart,
46 ExtRootScan,
47 ThreadRoots,
48 StringTableRoots,
49 UniverseRoots,
50 JNIRoots,
51 ObjectSynchronizerRoots,
52 FlatProfilerRoots,
53 ManagementRoots,
54 SystemDictionaryRoots,
136
137 double _recorded_preserve_cm_referents_time_ms;
138
139 double _recorded_merge_pss_time_ms;
140
141 double _recorded_start_new_cset_time_ms;
142
143 double _recorded_total_free_cset_time_ms;
144
145 double _recorded_serial_free_cset_time_ms;
146
147 double _cur_fast_reclaim_humongous_time_ms;
148 double _cur_fast_reclaim_humongous_register_time_ms;
149 size_t _cur_fast_reclaim_humongous_total;
150 size_t _cur_fast_reclaim_humongous_candidates;
151 size_t _cur_fast_reclaim_humongous_reclaimed;
152
153 double _cur_verify_before_time_ms;
154 double _cur_verify_after_time_ms;
155
156 ReferenceProcessorPhaseTimes _ref_phase_times;
157
158 double worker_time(GCParPhases phase, uint worker);
159 void note_gc_end();
160 void reset();
161
162 template <class T>
163 void details(T* phase, const char* indent) const;
164
165 void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const;
166 void debug_phase(WorkerDataArray<double>* phase) const;
167 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true) const;
168
169 void info_time(const char* name, double value) const;
170 void debug_time(const char* name, double value) const;
171 // This will print logs for both 'gc+phases' and 'gc+phases+ref'.
172 void debug_time_for_reference(const char* name, double value) const;
173 void trace_time(const char* name, double value) const;
174 void trace_count(const char* name, size_t value) const;
175
176 double print_pre_evacuate_collection_set() const;
177 double print_evacuate_collection_set() const;
178 double print_post_evacuate_collection_set() const;
179 void print_other(double accounted_ms) const;
180
181 public:
182 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
183 void note_gc_start();
184 void print();
185
186 // record the time a phase took in seconds
187 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
188
189 // add a number of seconds to a phase
190 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
191
192 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
193
194 // return the average time for a phase in milliseconds
195 double average_time_ms(GCParPhases phase);
196
197 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
198
199 public:
200
201 void record_prepare_tlab_time_ms(double ms) {
202 _cur_prepare_tlab_time_ms = ms;
335
336 double root_region_scan_wait_time_ms() {
337 return _root_region_scan_wait_time_ms;
338 }
339
340 double young_cset_choice_time_ms() {
341 return _recorded_young_cset_choice_time_ms;
342 }
343
344 double total_free_cset_time_ms() {
345 return _recorded_total_free_cset_time_ms;
346 }
347
348 double non_young_cset_choice_time_ms() {
349 return _recorded_non_young_cset_choice_time_ms;
350 }
351
352 double fast_reclaim_humongous_time_ms() {
353 return _cur_fast_reclaim_humongous_time_ms;
354 }
355
356 ReferenceProcessorPhaseTimes* ref_phase_times() { return &_ref_phase_times; }
357 };
358
359 class G1GCParPhaseTimesTracker : public StackObj {
360 double _start_time;
361 G1GCPhaseTimes::GCParPhases _phase;
362 G1GCPhaseTimes* _phase_times;
363 uint _worker_id;
364 public:
365 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
366 ~G1GCParPhaseTimesTracker();
367 };
368
369 #endif // SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
|