1 /*
2 * Copyright (c) 2013, 2017, 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 #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 ManagementRoots,
53 SystemDictionaryRoots,
181 void debug_time_for_reference(const char* name, double value) const;
182 void trace_time(const char* name, double value) const;
183 void trace_count(const char* name, size_t value) const;
184
185 double print_pre_evacuate_collection_set() const;
186 double print_evacuate_collection_set() const;
187 double print_post_evacuate_collection_set() const;
188 void print_other(double accounted_ms) const;
189
190 public:
191 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
192 void note_gc_start();
193 void print();
194
195 // record the time a phase took in seconds
196 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
197
198 // add a number of seconds to a phase
199 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
200
201 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
202
203 // return the average time for a phase in milliseconds
204 double average_time_ms(GCParPhases phase);
205
206 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
207
208 public:
209
210 void record_prepare_tlab_time_ms(double ms) {
211 _cur_prepare_tlab_time_ms = ms;
212 }
213
214 void record_resize_tlab_time_ms(double ms) {
215 _cur_resize_tlab_time_ms = ms;
216 }
217
218 void record_derived_pointer_table_update_time(double ms) {
219 _cur_derived_pointer_table_update_time_ms = ms;
220 }
352
353 double young_cset_choice_time_ms() {
354 return _recorded_young_cset_choice_time_ms;
355 }
356
357 double total_free_cset_time_ms() {
358 return _recorded_total_free_cset_time_ms;
359 }
360
361 double non_young_cset_choice_time_ms() {
362 return _recorded_non_young_cset_choice_time_ms;
363 }
364
365 double fast_reclaim_humongous_time_ms() {
366 return _cur_fast_reclaim_humongous_time_ms;
367 }
368
369 ReferenceProcessorPhaseTimes* ref_phase_times() { return &_ref_phase_times; }
370 };
371
372 class G1GCParPhaseTimesTracker : public StackObj {
373 double _start_time;
374 G1GCPhaseTimes::GCParPhases _phase;
375 G1GCPhaseTimes* _phase_times;
376 uint _worker_id;
377 public:
378 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
379 ~G1GCParPhaseTimesTracker();
380 };
381
382 #endif // SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
|
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 #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 G1ParScanThreadState;
35 class STWGCTimer;
36
37 template <class T> class WorkerDataArray;
38
39 class G1GCPhaseTimes : public CHeapObj<mtGC> {
40 uint _max_gc_threads;
41 jlong _gc_start_counter;
42 double _gc_pause_time_ms;
43
44 public:
45 enum GCParPhases {
46 GCWorkerStart,
47 ExtRootScan,
48 ThreadRoots,
49 StringTableRoots,
50 UniverseRoots,
51 JNIRoots,
52 ObjectSynchronizerRoots,
53 ManagementRoots,
54 SystemDictionaryRoots,
182 void debug_time_for_reference(const char* name, double value) const;
183 void trace_time(const char* name, double value) const;
184 void trace_count(const char* name, size_t value) const;
185
186 double print_pre_evacuate_collection_set() const;
187 double print_evacuate_collection_set() const;
188 double print_post_evacuate_collection_set() const;
189 void print_other(double accounted_ms) const;
190
191 public:
192 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
193 void note_gc_start();
194 void print();
195
196 // record the time a phase took in seconds
197 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
198
199 // add a number of seconds to a phase
200 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
201
202 void record_or_add_objcopy_time_secs(uint worker_i, double secs);
203
204 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
205
206 // return the average time for a phase in milliseconds
207 double average_time_ms(GCParPhases phase);
208
209 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
210
211 public:
212
213 void record_prepare_tlab_time_ms(double ms) {
214 _cur_prepare_tlab_time_ms = ms;
215 }
216
217 void record_resize_tlab_time_ms(double ms) {
218 _cur_resize_tlab_time_ms = ms;
219 }
220
221 void record_derived_pointer_table_update_time(double ms) {
222 _cur_derived_pointer_table_update_time_ms = ms;
223 }
355
356 double young_cset_choice_time_ms() {
357 return _recorded_young_cset_choice_time_ms;
358 }
359
360 double total_free_cset_time_ms() {
361 return _recorded_total_free_cset_time_ms;
362 }
363
364 double non_young_cset_choice_time_ms() {
365 return _recorded_non_young_cset_choice_time_ms;
366 }
367
368 double fast_reclaim_humongous_time_ms() {
369 return _cur_fast_reclaim_humongous_time_ms;
370 }
371
372 ReferenceProcessorPhaseTimes* ref_phase_times() { return &_ref_phase_times; }
373 };
374
375 class G1EvacPhaseWithTrimTimeTracker : public StackObj {
376 G1ParScanThreadState* _pss;
377 Ticks _start;
378
379 Tickspan& _total_time;
380 Tickspan& _trim_time;
381 public:
382 G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time);
383 ~G1EvacPhaseWithTrimTimeTracker();
384 };
385
386 class G1GCParPhaseTimesTracker : public CHeapObj<mtGC> {
387 protected:
388 Ticks _start_time;
389 G1GCPhaseTimes::GCParPhases _phase;
390 G1GCPhaseTimes* _phase_times;
391 uint _worker_id;
392 public:
393 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
394 virtual ~G1GCParPhaseTimesTracker();
395 };
396
397 class G1EvacPhaseTimesTracker : public G1GCParPhaseTimesTracker {
398 Tickspan _total_time;
399 Tickspan _trim_time;
400
401 G1EvacPhaseWithTrimTimeTracker _trim_tracker;
402 public:
403 G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1ParScanThreadState* pss, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
404 virtual ~G1EvacPhaseTimesTracker();
405 };
406
407 #endif // SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
|