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,
179 void debug_time_for_reference(const char* name, double value) const;
180 void trace_time(const char* name, double value) const;
181 void trace_count(const char* name, size_t value) const;
182
183 double print_pre_evacuate_collection_set() const;
184 double print_evacuate_collection_set() const;
185 double print_post_evacuate_collection_set() const;
186 void print_other(double accounted_ms) const;
187
188 public:
189 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
190 void note_gc_start();
191 void print();
192
193 // record the time a phase took in seconds
194 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
195
196 // add a number of seconds to a phase
197 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
198
199 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
200
201 // return the average time for a phase in milliseconds
202 double average_time_ms(GCParPhases phase);
203
204 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
205
206 public:
207
208 void record_prepare_tlab_time_ms(double ms) {
209 _cur_prepare_tlab_time_ms = ms;
210 }
211
212 void record_resize_tlab_time_ms(double ms) {
213 _cur_resize_tlab_time_ms = ms;
214 }
215
216 void record_derived_pointer_table_update_time(double ms) {
217 _cur_derived_pointer_table_update_time_ms = ms;
218 }
346
347 double young_cset_choice_time_ms() {
348 return _recorded_young_cset_choice_time_ms;
349 }
350
351 double total_free_cset_time_ms() {
352 return _recorded_total_free_cset_time_ms;
353 }
354
355 double non_young_cset_choice_time_ms() {
356 return _recorded_non_young_cset_choice_time_ms;
357 }
358
359 double fast_reclaim_humongous_time_ms() {
360 return _cur_fast_reclaim_humongous_time_ms;
361 }
362
363 ReferenceProcessorPhaseTimes* ref_phase_times() { return &_ref_phase_times; }
364 };
365
366 class G1GCParPhaseTimesTracker : public StackObj {
367 double _start_time;
368 G1GCPhaseTimes::GCParPhases _phase;
369 G1GCPhaseTimes* _phase_times;
370 uint _worker_id;
371 public:
372 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
373 ~G1GCParPhaseTimesTracker();
374 };
375
376 #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,
180 void debug_time_for_reference(const char* name, double value) const;
181 void trace_time(const char* name, double value) const;
182 void trace_count(const char* name, size_t value) const;
183
184 double print_pre_evacuate_collection_set() const;
185 double print_evacuate_collection_set() const;
186 double print_post_evacuate_collection_set() const;
187 void print_other(double accounted_ms) const;
188
189 public:
190 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
191 void note_gc_start();
192 void print();
193
194 // record the time a phase took in seconds
195 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
196
197 // add a number of seconds to a phase
198 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
199
200 void record_or_add_objcopy_time_secs(uint worker_i, double secs);
201
202 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
203
204 // return the average time for a phase in milliseconds
205 double average_time_ms(GCParPhases phase);
206
207 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
208
209 public:
210
211 void record_prepare_tlab_time_ms(double ms) {
212 _cur_prepare_tlab_time_ms = ms;
213 }
214
215 void record_resize_tlab_time_ms(double ms) {
216 _cur_resize_tlab_time_ms = ms;
217 }
218
219 void record_derived_pointer_table_update_time(double ms) {
220 _cur_derived_pointer_table_update_time_ms = ms;
221 }
349
350 double young_cset_choice_time_ms() {
351 return _recorded_young_cset_choice_time_ms;
352 }
353
354 double total_free_cset_time_ms() {
355 return _recorded_total_free_cset_time_ms;
356 }
357
358 double non_young_cset_choice_time_ms() {
359 return _recorded_non_young_cset_choice_time_ms;
360 }
361
362 double fast_reclaim_humongous_time_ms() {
363 return _cur_fast_reclaim_humongous_time_ms;
364 }
365
366 ReferenceProcessorPhaseTimes* ref_phase_times() { return &_ref_phase_times; }
367 };
368
369 class G1EvacPhaseWithTrimTimeTracker : public StackObj {
370 G1ParScanThreadState* _pss;
371 Ticks _start;
372
373 Tickspan& _total_time;
374 Tickspan& _trim_time;
375 public:
376 G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time);
377 ~G1EvacPhaseWithTrimTimeTracker();
378 };
379
380 class G1GCParPhaseTimesTracker : public CHeapObj<mtGC> {
381 protected:
382 Ticks _start_time;
383 G1GCPhaseTimes::GCParPhases _phase;
384 G1GCPhaseTimes* _phase_times;
385 uint _worker_id;
386 public:
387 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
388 virtual ~G1GCParPhaseTimesTracker();
389 };
390
391 class G1EvacPhaseTimesTracker : public G1GCParPhaseTimesTracker {
392 Tickspan _total_time;
393 Tickspan _trim_time;
394
395 G1EvacPhaseWithTrimTimeTracker _trim_tracker;
396 public:
397 G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1ParScanThreadState* pss, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
398 virtual ~G1EvacPhaseTimesTracker();
399 };
400
401 #endif // SHARE_VM_GC_G1_G1GCPHASETIMES_HPP
|