annotate src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @ 6219:922993931b3d

7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause Summary: Also reviewed by: vitalyd@gmail.com. Move the timing out of G1CollectorPolicy into the G1GCPhaseTimes class Reviewed-by: johnc
author brutisso
date Wed, 11 Jul 2012 22:47:38 +0200
parents
children bb3f6194fedb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
1 /*
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
4 *
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
7 * published by the Free Software Foundation.
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
8 *
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
13 * accompanied this code).
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
14 *
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
18 *
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
21 * questions.
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
22 *
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
23 */
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
24
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
25
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
26 #include "precompiled.hpp"
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
28 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
29 #include "gc_implementation/g1/g1Log.hpp"
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
30
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
31 // Helper class for avoiding interleaved logging
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
32 class LineBuffer: public StackObj {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
33
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
34 private:
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
35 static const int BUFFER_LEN = 1024;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
36 static const int INDENT_CHARS = 3;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
37 char _buffer[BUFFER_LEN];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
38 int _indent_level;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
39 int _cur;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
40
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
41 void vappend(const char* format, va_list ap) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
42 int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
43 if (res != -1) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
44 _cur += res;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
45 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
46 DEBUG_ONLY(warning("buffer too small in LineBuffer");)
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
47 _buffer[BUFFER_LEN -1] = 0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
48 _cur = BUFFER_LEN; // vsnprintf above should not add to _buffer if we are called again
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
49 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
50 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
51
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
52 public:
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
53 explicit LineBuffer(int indent_level): _indent_level(indent_level), _cur(0) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
54 for (; (_cur < BUFFER_LEN && _cur < (_indent_level * INDENT_CHARS)); _cur++) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
55 _buffer[_cur] = ' ';
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
56 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
57 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
58
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
59 #ifndef PRODUCT
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
60 ~LineBuffer() {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
61 assert(_cur == _indent_level * INDENT_CHARS, "pending data in buffer - append_and_print_cr() not called?");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
62 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
63 #endif
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
64
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
65 void append(const char* format, ...) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
66 va_list ap;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
67 va_start(ap, format);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
68 vappend(format, ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
69 va_end(ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
70 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
71
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
72 void append_and_print_cr(const char* format, ...) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
73 va_list ap;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
74 va_start(ap, format);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
75 vappend(format, ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
76 va_end(ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
77 gclog_or_tty->print_cr("%s", _buffer);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
78 _cur = _indent_level * INDENT_CHARS;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
79 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
80 };
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
81
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
82 G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) :
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
83 _max_gc_threads(max_gc_threads),
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
84 _min_clear_cc_time_ms(-1.0),
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
85 _max_clear_cc_time_ms(-1.0),
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
86 _cur_clear_cc_time_ms(0.0),
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
87 _cum_clear_cc_time_ms(0.0),
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
88 _num_cc_clears(0L)
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
89 {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
90 assert(max_gc_threads > 0, "Must have some GC threads");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
91 _par_last_gc_worker_start_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
92 _par_last_ext_root_scan_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
93 _par_last_satb_filtering_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
94 _par_last_update_rs_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
95 _par_last_update_rs_processed_buffers = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
96 _par_last_scan_rs_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
97 _par_last_obj_copy_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
98 _par_last_termination_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
99 _par_last_termination_attempts = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
100 _par_last_gc_worker_end_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
101 _par_last_gc_worker_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
102 _par_last_gc_worker_other_times_ms = new double[_max_gc_threads];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
103 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
104
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
105 void G1GCPhaseTimes::note_gc_start(double pause_start_time_sec, uint active_gc_threads,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
106 bool is_young_gc, bool is_initial_mark_gc, GCCause::Cause gc_cause) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
107 assert(active_gc_threads > 0, "The number of threads must be > 0");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
108 assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max nubmer of threads");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
109 _active_gc_threads = active_gc_threads;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
110 _pause_start_time_sec = pause_start_time_sec;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
111 _is_young_gc = is_young_gc;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
112 _is_initial_mark_gc = is_initial_mark_gc;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
113 _gc_cause = gc_cause;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
114
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
115 #ifdef ASSERT
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
116 // initialise the timing data to something well known so that we can spot
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
117 // if something is not set properly
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
118
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
119 for (uint i = 0; i < _max_gc_threads; ++i) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
120 _par_last_gc_worker_start_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
121 _par_last_ext_root_scan_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
122 _par_last_satb_filtering_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
123 _par_last_update_rs_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
124 _par_last_update_rs_processed_buffers[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
125 _par_last_scan_rs_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
126 _par_last_obj_copy_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
127 _par_last_termination_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
128 _par_last_termination_attempts[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
129 _par_last_gc_worker_end_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
130 _par_last_gc_worker_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
131 _par_last_gc_worker_other_times_ms[i] = -1234.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
132 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
133 #endif
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
134 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
135
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
136 void G1GCPhaseTimes::note_gc_end(double pause_end_time_sec) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
137 if (G1Log::fine()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
138 double pause_time_ms = (pause_end_time_sec - _pause_start_time_sec) * MILLIUNITS;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
139
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
140 for (uint i = 0; i < _active_gc_threads; i++) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
141 _par_last_gc_worker_times_ms[i] = _par_last_gc_worker_end_times_ms[i] -
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
142 _par_last_gc_worker_start_times_ms[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
143
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
144 double worker_known_time = _par_last_ext_root_scan_times_ms[i] +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
145 _par_last_satb_filtering_times_ms[i] +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
146 _par_last_update_rs_times_ms[i] +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
147 _par_last_scan_rs_times_ms[i] +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
148 _par_last_obj_copy_times_ms[i] +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
149 _par_last_termination_times_ms[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
150
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
151 _par_last_gc_worker_other_times_ms[i] = _par_last_gc_worker_times_ms[i] -
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
152 worker_known_time;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
153 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
154
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
155 print(pause_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
156 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
157
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
158 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
159
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
160 void G1GCPhaseTimes::print_par_stats(int level,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
161 const char* str,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
162 double* data,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
163 bool showDecimals) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
164 double min = data[0], max = data[0];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
165 double total = 0.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
166 LineBuffer buf(level);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
167 buf.append("[%s (ms):", str);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
168 for (uint i = 0; i < _active_gc_threads; ++i) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
169 double val = data[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
170 if (val < min)
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
171 min = val;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
172 if (val > max)
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
173 max = val;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
174 total += val;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
175 if (G1Log::finest()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
176 if (showDecimals) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
177 buf.append(" %.1lf", val);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
178 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
179 buf.append(" %d", (int)val);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
180 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
181 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
182 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
183
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
184 if (G1Log::finest()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
185 buf.append_and_print_cr("");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
186 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
187 double avg = total / (double) _active_gc_threads;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
188 if (showDecimals) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
189 buf.append_and_print_cr(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf, Sum: %.1lf]",
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
190 min, avg, max, max - min, total);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
191 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
192 buf.append_and_print_cr(" Min: %d, Avg: %d, Max: %d, Diff: %d, Sum: %d]",
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
193 (int)min, (int)avg, (int)max, (int)max - (int)min, (int)total);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
194 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
195 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
196
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
197 void G1GCPhaseTimes::print_stats(int level, const char* str, double value) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
198 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
199 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
200
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
201 void G1GCPhaseTimes::print_stats(int level, const char* str, double value, int workers) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
202 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %d]", str, value, workers);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
203 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
204
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
205 void G1GCPhaseTimes::print_stats(int level, const char* str, int value) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
206 LineBuffer(level).append_and_print_cr("[%s: %d]", str, value);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
207 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
208
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
209 double G1GCPhaseTimes::avg_value(double* data) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
210 if (G1CollectedHeap::use_parallel_gc_threads()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
211 double ret = 0.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
212 for (uint i = 0; i < _active_gc_threads; ++i) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
213 ret += data[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
214 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
215 return ret / (double) _active_gc_threads;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
216 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
217 return data[0];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
218 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
219 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
220
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
221 double G1GCPhaseTimes::max_value(double* data) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
222 if (G1CollectedHeap::use_parallel_gc_threads()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
223 double ret = data[0];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
224 for (uint i = 1; i < _active_gc_threads; ++i) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
225 if (data[i] > ret) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
226 ret = data[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
227 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
228 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
229 return ret;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
230 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
231 return data[0];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
232 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
233 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
234
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
235 double G1GCPhaseTimes::sum_of_values(double* data) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
236 if (G1CollectedHeap::use_parallel_gc_threads()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
237 double sum = 0.0;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
238 for (uint i = 0; i < _active_gc_threads; i++) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
239 sum += data[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
240 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
241 return sum;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
242 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
243 return data[0];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
244 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
245 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
246
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
247 double G1GCPhaseTimes::max_sum(double* data1, double* data2) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
248 double ret = data1[0] + data2[0];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
249
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
250 if (G1CollectedHeap::use_parallel_gc_threads()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
251 for (uint i = 1; i < _active_gc_threads; ++i) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
252 double data = data1[i] + data2[i];
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
253 if (data > ret) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
254 ret = data;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
255 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
256 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
257 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
258 return ret;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
259 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
260
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
261 void G1GCPhaseTimes::collapse_par_times() {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
262 _ext_root_scan_time = avg_value(_par_last_ext_root_scan_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
263 _satb_filtering_time = avg_value(_par_last_satb_filtering_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
264 _update_rs_time = avg_value(_par_last_update_rs_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
265 _update_rs_processed_buffers =
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
266 sum_of_values(_par_last_update_rs_processed_buffers);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
267 _scan_rs_time = avg_value(_par_last_scan_rs_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
268 _obj_copy_time = avg_value(_par_last_obj_copy_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
269 _termination_time = avg_value(_par_last_termination_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
270 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
271
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
272 double G1GCPhaseTimes::accounted_time_ms() {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
273 // Subtract the root region scanning wait time. It's initialized to
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
274 // zero at the start of the pause.
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
275 double misc_time_ms = _root_region_scan_wait_time_ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
276
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
277 misc_time_ms += _cur_collection_par_time_ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
278
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
279 // Now subtract the time taken to fix up roots in generated code
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
280 misc_time_ms += _cur_collection_code_root_fixup_time_ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
281
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
282 // Subtract the time taken to clean the card table from the
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
283 // current value of "other time"
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
284 misc_time_ms += _cur_clear_ct_time_ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
285
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
286 return misc_time_ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
287 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
288
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
289 void G1GCPhaseTimes::print(double pause_time_ms) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
290
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
291 if (PrintGCTimeStamps) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
292 gclog_or_tty->stamp();
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
293 gclog_or_tty->print(": ");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
294 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
295
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
296 GCCauseString gc_cause_str = GCCauseString("GC pause", _gc_cause)
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
297 .append(_is_young_gc ? " (young)" : " (mixed)")
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
298 .append(_is_initial_mark_gc ? " (initial-mark)" : "");
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
299 gclog_or_tty->print_cr("[%s, %3.7f secs]", (const char*)gc_cause_str, pause_time_ms / 1000.0);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
300
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
301 if (!G1Log::finer()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
302 return;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
303 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
304
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
305 if (_root_region_scan_wait_time_ms > 0.0) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
306 print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
307 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
308 if (G1CollectedHeap::use_parallel_gc_threads()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
309 print_stats(1, "Parallel Time", _cur_collection_par_time_ms, _active_gc_threads);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
310 print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
311 print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
312 if (_satb_filtering_time > 0.0) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
313 print_par_stats(2, "SATB Filtering", _par_last_satb_filtering_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
314 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
315 print_par_stats(2, "Update RS", _par_last_update_rs_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
316 if (G1Log::finest()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
317 print_par_stats(3, "Processed Buffers", _par_last_update_rs_processed_buffers,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
318 false /* showDecimals */);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
319 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
320 print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
321 print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
322 print_par_stats(2, "Termination", _par_last_termination_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
323 if (G1Log::finest()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
324 print_par_stats(3, "Termination Attempts", _par_last_termination_attempts,
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
325 false /* showDecimals */);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
326 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
327 print_par_stats(2, "GC Worker Other", _par_last_gc_worker_other_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
328 print_par_stats(2, "GC Worker Total", _par_last_gc_worker_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
329 print_par_stats(2, "GC Worker End", _par_last_gc_worker_end_times_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
330 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
331 print_stats(1, "Ext Root Scanning", _ext_root_scan_time);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
332 if (_satb_filtering_time > 0.0) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
333 print_stats(1, "SATB Filtering", _satb_filtering_time);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
334 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
335 print_stats(1, "Update RS", _update_rs_time);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
336 if (G1Log::finest()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
337 print_stats(2, "Processed Buffers", (int)_update_rs_processed_buffers);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
338 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
339 print_stats(1, "Scan RS", _scan_rs_time);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
340 print_stats(1, "Object Copying", _obj_copy_time);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
341 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
342 print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
343 print_stats(1, "Clear CT", _cur_clear_ct_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
344 if (Verbose && G1Log::finest()) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
345 print_stats(1, "Cur Clear CC", _cur_clear_cc_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
346 print_stats(1, "Cum Clear CC", _cum_clear_cc_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
347 print_stats(1, "Min Clear CC", _min_clear_cc_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
348 print_stats(1, "Max Clear CC", _max_clear_cc_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
349 if (_num_cc_clears > 0) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
350 print_stats(1, "Avg Clear CC", _cum_clear_cc_time_ms / ((double)_num_cc_clears));
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
351 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
352 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
353 double misc_time_ms = pause_time_ms - accounted_time_ms();
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
354 print_stats(1, "Other", misc_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
355 print_stats(2, "Choose CSet",
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
356 (_recorded_young_cset_choice_time_ms +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
357 _recorded_non_young_cset_choice_time_ms));
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
358 print_stats(2, "Ref Proc", _cur_ref_proc_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
359 print_stats(2, "Ref Enq", _cur_ref_enq_time_ms);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
360 print_stats(2, "Free CSet",
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
361 (_recorded_young_free_cset_time_ms +
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
362 _recorded_non_young_free_cset_time_ms));
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
363 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
364
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
365 void G1GCPhaseTimes::record_cc_clear_time_ms(double ms) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
366 if (!(Verbose && G1Log::finest())) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
367 return;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
368 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
369
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
370 if (_min_clear_cc_time_ms < 0.0 || ms <= _min_clear_cc_time_ms) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
371 _min_clear_cc_time_ms = ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
372 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
373 if (_max_clear_cc_time_ms < 0.0 || ms >= _max_clear_cc_time_ms) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
374 _max_clear_cc_time_ms = ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
375 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
376 _cur_clear_cc_time_ms = ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
377 _cum_clear_cc_time_ms += ms;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
378 _num_cc_clears++;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
379 }