annotate src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @ 20504:6948da6d7c13

8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set Summary: Remove -XX:-G1DeferredRSUpdate functionality as it is racy. During evacuation failure handling, threads where evacuation failure handling occurred may try to add remembered sets to regions which remembered sets are currently being scanned. The iterator to handle the remembered set scan does not support addition of entries during scan and so may skip valid references. Reviewed-by: iveresov, brutisso, mgerdin
author tschatzl
date Tue, 30 Sep 2014 09:44:36 +0200
parents 7baf47cb97cb
children
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 /*
17753
191174b49bec 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents: 12080
diff changeset
2 * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
6219
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"
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
30 #include "gc_implementation/g1/g1StringDedup.hpp"
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
31
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
32 // 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
33 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
34
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
35 private:
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 BUFFER_LEN = 1024;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
37 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
38 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
39 int _indent_level;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
40 int _cur;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
41
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
42 void vappend(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) {
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
43 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
44 if (res != -1) {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
45 _cur += res;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
46 } else {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
47 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
48 _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
49 _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
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
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
53 public:
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
54 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
55 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
56 _buffer[_cur] = ' ';
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
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
60 #ifndef PRODUCT
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
61 ~LineBuffer() {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
62 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
63 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
64 #endif
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
65
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
66 void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
67 va_list ap;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
68 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
69 vappend(format, ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
70 va_end(ap);
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
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
73 void append_and_print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
74 va_list ap;
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
75 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
76 vappend(format, ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
77 va_end(ap);
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
78 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
79 _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
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
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
83 PRAGMA_DIAG_PUSH
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
84 PRAGMA_FORMAT_NONLITERAL_IGNORED
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
85 template <class T>
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
86 void WorkerDataArray<T>::print(int level, const char* title) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
87 if (_length == 1) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
88 // No need for min, max, average and sum for only one worker
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
89 LineBuffer buf(level);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
90 buf.append("[%s: ", title);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
91 buf.append(_print_format, _data[0]);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
92 buf.append_and_print_cr("]");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
93 return;
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
94 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
95
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
96 T min = _data[0];
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
97 T max = _data[0];
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
98 T sum = 0;
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
99
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
100 LineBuffer buf(level);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
101 buf.append("[%s:", title);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
102 for (uint i = 0; i < _length; ++i) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
103 T val = _data[i];
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
104 min = MIN2(val, min);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
105 max = MAX2(val, max);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
106 sum += val;
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
107 if (G1Log::finest()) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
108 buf.append(" ");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
109 buf.append(_print_format, val);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
110 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
111 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
112
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
113 if (G1Log::finest()) {
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
114 buf.append_and_print_cr("%s", "");
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
115 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
116
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
117 double avg = (double)sum / (double)_length;
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
118 buf.append(" Min: ");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
119 buf.append(_print_format, min);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
120 buf.append(", Avg: ");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
121 buf.append("%.1lf", avg); // Always print average as a double
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
122 buf.append(", Max: ");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
123 buf.append(_print_format, max);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
124 buf.append(", Diff: ");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
125 buf.append(_print_format, max - min);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
126 if (_print_sum) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
127 // for things like the start and end times the sum is not
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
128 // that relevant
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
129 buf.append(", Sum: ");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
130 buf.append(_print_format, sum);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
131 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
132 buf.append_and_print_cr("]");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
133 }
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17844
diff changeset
134 PRAGMA_DIAG_POP
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
135
6786
5baec2e69518 7200615: NPG: optimized VM build is broken
jmasa
parents: 6628
diff changeset
136 #ifndef PRODUCT
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
137
7633
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
138 template <> const int WorkerDataArray<int>::_uninitialized = -1;
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
139 template <> const double WorkerDataArray<double>::_uninitialized = -1.0;
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
140 template <> const size_t WorkerDataArray<size_t>::_uninitialized = (size_t)-1;
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
141
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
142 template <class T>
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
143 void WorkerDataArray<T>::reset() {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
144 for (uint i = 0; i < _length; i++) {
7633
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
145 _data[i] = (T)_uninitialized;
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
146 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
147 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
148
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
149 template <class T>
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
150 void WorkerDataArray<T>::verify() {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
151 for (uint i = 0; i < _length; i++) {
7633
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
152 assert(_data[i] != _uninitialized,
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
153 err_msg("Invalid data for worker " UINT32_FORMAT ", data: %lf, uninitialized: %lf",
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
154 i, (double)_data[i], (double)_uninitialized));
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
155 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
156 }
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
157
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
158 #endif
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
159
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
160 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
161 _max_gc_threads(max_gc_threads),
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
162 _last_gc_worker_start_times_ms(_max_gc_threads, "%.1lf", false),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
163 _last_ext_root_scan_times_ms(_max_gc_threads, "%.1lf"),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
164 _last_satb_filtering_times_ms(_max_gc_threads, "%.1lf"),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
165 _last_update_rs_times_ms(_max_gc_threads, "%.1lf"),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
166 _last_update_rs_processed_buffers(_max_gc_threads, "%d"),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
167 _last_scan_rs_times_ms(_max_gc_threads, "%.1lf"),
12080
5888334c9c24 7145569: G1: optimize nmethods scanning
johnc
parents: 10246
diff changeset
168 _last_strong_code_root_scan_times_ms(_max_gc_threads, "%.1lf"),
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
169 _last_obj_copy_times_ms(_max_gc_threads, "%.1lf"),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
170 _last_termination_times_ms(_max_gc_threads, "%.1lf"),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
171 _last_termination_attempts(_max_gc_threads, SIZE_FORMAT),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
172 _last_gc_worker_end_times_ms(_max_gc_threads, "%.1lf", false),
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
173 _last_gc_worker_times_ms(_max_gc_threads, "%.1lf"),
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
174 _last_gc_worker_other_times_ms(_max_gc_threads, "%.1lf"),
20216
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
175 _last_redirty_logged_cards_time_ms(_max_gc_threads, "%.1lf"),
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
176 _last_redirty_logged_cards_processed_cards(_max_gc_threads, SIZE_FORMAT),
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
177 _cur_string_dedup_queue_fixup_worker_times_ms(_max_gc_threads, "%.1lf"),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
178 _cur_string_dedup_table_fixup_worker_times_ms(_max_gc_threads, "%.1lf")
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
179 {
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
180 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
181 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
182
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
183 void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) {
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
184 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
185 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
186 _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
187
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
188 _last_gc_worker_start_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
189 _last_ext_root_scan_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
190 _last_satb_filtering_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
191 _last_update_rs_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
192 _last_update_rs_processed_buffers.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
193 _last_scan_rs_times_ms.reset();
12080
5888334c9c24 7145569: G1: optimize nmethods scanning
johnc
parents: 10246
diff changeset
194 _last_strong_code_root_scan_times_ms.reset();
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
195 _last_obj_copy_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
196 _last_termination_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
197 _last_termination_attempts.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
198 _last_gc_worker_end_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
199 _last_gc_worker_times_ms.reset();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
200 _last_gc_worker_other_times_ms.reset();
20216
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
201
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
202 _last_redirty_logged_cards_time_ms.reset();
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
203 _last_redirty_logged_cards_processed_cards.reset();
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
204
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
205 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
206
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
207 void G1GCPhaseTimes::note_gc_end() {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
208 _last_gc_worker_start_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
209 _last_ext_root_scan_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
210 _last_satb_filtering_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
211 _last_update_rs_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
212 _last_update_rs_processed_buffers.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
213 _last_scan_rs_times_ms.verify();
12080
5888334c9c24 7145569: G1: optimize nmethods scanning
johnc
parents: 10246
diff changeset
214 _last_strong_code_root_scan_times_ms.verify();
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
215 _last_obj_copy_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
216 _last_termination_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
217 _last_termination_attempts.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
218 _last_gc_worker_end_times_ms.verify();
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
219
7633
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
220 for (uint i = 0; i < _active_gc_threads; i++) {
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
221 double worker_time = _last_gc_worker_end_times_ms.get(i) - _last_gc_worker_start_times_ms.get(i);
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
222 _last_gc_worker_times_ms.set(i, worker_time);
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
223
7633
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
224 double worker_known_time = _last_ext_root_scan_times_ms.get(i) +
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 7633
diff changeset
225 _last_satb_filtering_times_ms.get(i) +
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 7633
diff changeset
226 _last_update_rs_times_ms.get(i) +
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 7633
diff changeset
227 _last_scan_rs_times_ms.get(i) +
12080
5888334c9c24 7145569: G1: optimize nmethods scanning
johnc
parents: 10246
diff changeset
228 _last_strong_code_root_scan_times_ms.get(i) +
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 7633
diff changeset
229 _last_obj_copy_times_ms.get(i) +
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 7633
diff changeset
230 _last_termination_times_ms.get(i);
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
231
7633
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
232 double worker_other_time = worker_time - worker_known_time;
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
233 _last_gc_worker_other_times_ms.set(i, worker_other_time);
7df93f7c14a5 8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations
brutisso
parents: 6786
diff changeset
234 }
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
235
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
236 _last_gc_worker_times_ms.verify();
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
237 _last_gc_worker_other_times_ms.verify();
20216
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17937
diff changeset
238
20504
6948da6d7c13 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 20494
diff changeset
239 _last_redirty_logged_cards_time_ms.verify();
6948da6d7c13 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 20494
diff changeset
240 _last_redirty_logged_cards_processed_cards.verify();
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
241 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
242
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
243 void G1GCPhaseTimes::note_string_dedup_fixup_start() {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
244 _cur_string_dedup_queue_fixup_worker_times_ms.reset();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
245 _cur_string_dedup_table_fixup_worker_times_ms.reset();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
246 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
247
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
248 void G1GCPhaseTimes::note_string_dedup_fixup_end() {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
249 _cur_string_dedup_queue_fixup_worker_times_ms.verify();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
250 _cur_string_dedup_table_fixup_worker_times_ms.verify();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
251 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
252
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
253 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
254 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
255 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
256
20296
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
257 void G1GCPhaseTimes::print_stats(int level, const char* str, size_t value) {
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
258 LineBuffer(level).append_and_print_cr("[%s: "SIZE_FORMAT"]", str, value);
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
259 }
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
260
17844
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 17764
diff changeset
261 void G1GCPhaseTimes::print_stats(int level, const char* str, double value, uint workers) {
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 17764
diff changeset
262 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: " UINT32_FORMAT "]", str, value, workers);
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
263 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
264
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
265 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
266 // 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
267 // 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
268 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
269
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
270 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
271
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
272 // 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
273 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
274
17753
191174b49bec 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents: 12080
diff changeset
275 // Strong code root purge time
191174b49bec 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents: 12080
diff changeset
276 misc_time_ms += _cur_strong_code_root_purge_time_ms;
191174b49bec 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents: 12080
diff changeset
277
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
278 if (G1StringDedup::is_enabled()) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
279 // String dedup fixup time
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
280 misc_time_ms += _cur_string_dedup_fixup_time_ms;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
281 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
282
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
283 // 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
284 // 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
285 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
286
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
287 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
288 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
289
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
290 void G1GCPhaseTimes::print(double pause_time_sec) {
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
291 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
292 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
293 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
294 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
295 print_stats(1, "Parallel Time", _cur_collection_par_time_ms, _active_gc_threads);
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
296 _last_gc_worker_start_times_ms.print(2, "GC Worker Start (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
297 _last_ext_root_scan_times_ms.print(2, "Ext Root Scanning (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
298 if (_last_satb_filtering_times_ms.sum() > 0.0) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
299 _last_satb_filtering_times_ms.print(2, "SATB Filtering (ms)");
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
300 }
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
301 _last_update_rs_times_ms.print(2, "Update RS (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
302 _last_update_rs_processed_buffers.print(3, "Processed Buffers");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
303 _last_scan_rs_times_ms.print(2, "Scan RS (ms)");
12080
5888334c9c24 7145569: G1: optimize nmethods scanning
johnc
parents: 10246
diff changeset
304 _last_strong_code_root_scan_times_ms.print(2, "Code Root Scanning (ms)");
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
305 _last_obj_copy_times_ms.print(2, "Object Copy (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
306 _last_termination_times_ms.print(2, "Termination (ms)");
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
307 if (G1Log::finest()) {
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
308 _last_termination_attempts.print(3, "Termination Attempts");
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
309 }
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
310 _last_gc_worker_other_times_ms.print(2, "GC Worker Other (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
311 _last_gc_worker_times_ms.print(2, "GC Worker Total (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
312 _last_gc_worker_end_times_ms.print(2, "GC Worker End (ms)");
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
313 } else {
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
314 _last_ext_root_scan_times_ms.print(1, "Ext Root Scanning (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
315 if (_last_satb_filtering_times_ms.sum() > 0.0) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
316 _last_satb_filtering_times_ms.print(1, "SATB Filtering (ms)");
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
317 }
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
318 _last_update_rs_times_ms.print(1, "Update RS (ms)");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
319 _last_update_rs_processed_buffers.print(2, "Processed Buffers");
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
320 _last_scan_rs_times_ms.print(1, "Scan RS (ms)");
12080
5888334c9c24 7145569: G1: optimize nmethods scanning
johnc
parents: 10246
diff changeset
321 _last_strong_code_root_scan_times_ms.print(1, "Code Root Scanning (ms)");
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
322 _last_obj_copy_times_ms.print(1, "Object Copy (ms)");
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
323 }
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
324 print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms);
17753
191174b49bec 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents: 12080
diff changeset
325 print_stats(1, "Code Root Purge", _cur_strong_code_root_purge_time_ms);
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
326 if (G1StringDedup::is_enabled()) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
327 print_stats(1, "String Dedup Fixup", _cur_string_dedup_fixup_time_ms, _active_gc_threads);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
328 _cur_string_dedup_queue_fixup_worker_times_ms.print(2, "Queue Fixup (ms)");
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
329 _cur_string_dedup_table_fixup_worker_times_ms.print(2, "Table Fixup (ms)");
595c0f60d50d 8029075: String deduplication in G1
pliden
parents: 17757
diff changeset
330 }
6219
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, "Clear CT", _cur_clear_ct_time_ms);
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
332 double misc_time_ms = pause_time_sec * MILLIUNITS - accounted_time_ms();
6219
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, "Other", misc_time_ms);
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
334 if (_cur_verify_before_time_ms > 0.0) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
335 print_stats(2, "Verify Before", _cur_verify_before_time_ms);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
336 }
17757
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
337 if (G1CollectedHeap::heap()->evacuation_failed()) {
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
338 double evac_fail_handling = _cur_evac_fail_recalc_used + _cur_evac_fail_remove_self_forwards +
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
339 _cur_evac_fail_restore_remsets;
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
340 print_stats(2, "Evacuation Failure", evac_fail_handling);
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
341 if (G1Log::finest()) {
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
342 print_stats(3, "Recalculate Used", _cur_evac_fail_recalc_used);
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
343 print_stats(3, "Remove Self Forwards", _cur_evac_fail_remove_self_forwards);
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
344 print_stats(3, "Restore RemSet", _cur_evac_fail_restore_remsets);
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
345 }
eff02b5bd56c 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 17756
diff changeset
346 }
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
347 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
348 (_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
349 _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
350 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
351 print_stats(2, "Ref Enq", _cur_ref_enq_time_ms);
20504
6948da6d7c13 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 20494
diff changeset
352 print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms);
6948da6d7c13 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 20494
diff changeset
353 if (G1Log::finest()) {
6948da6d7c13 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 20494
diff changeset
354 _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty");
6948da6d7c13 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 20494
diff changeset
355 _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards");
17756
a07bea31ef35 8035398: Add card redirty time in "Other" time in G1
tschatzl
parents: 17755
diff changeset
356 }
20296
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
357 if (G1ReclaimDeadHumongousObjectsAtYoungGC) {
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
358 print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
359 if (G1Log::finest()) {
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
360 print_stats(3, "Humongous Total", _cur_fast_reclaim_humongous_total);
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
361 print_stats(3, "Humongous Candidate", _cur_fast_reclaim_humongous_candidates);
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
362 print_stats(3, "Humongous Reclaimed", _cur_fast_reclaim_humongous_reclaimed);
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
363 }
a3953c777565 8027959: Early reclamation of large objects in G1
tschatzl
parents: 20278
diff changeset
364 }
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
365 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
366 (_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
367 _recorded_non_young_free_cset_time_ms));
17755
96b1c2e06e25 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 17753
diff changeset
368 if (G1Log::finest()) {
96b1c2e06e25 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 17753
diff changeset
369 print_stats(3, "Young Free CSet", _recorded_young_free_cset_time_ms);
96b1c2e06e25 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 17753
diff changeset
370 print_stats(3, "Non-Young Free CSet", _recorded_non_young_free_cset_time_ms);
96b1c2e06e25 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 17753
diff changeset
371 }
6628
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
372 if (_cur_verify_after_time_ms > 0.0) {
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
373 print_stats(2, "Verify After", _cur_verify_after_time_ms);
bb3f6194fedb 7178363: G1: Remove the serial code for PrintGCDetails and make it a special case of the parallel code
brutisso
parents: 6219
diff changeset
374 }
6219
922993931b3d 7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
diff changeset
375 }