annotate src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp @ 11979:8d4ff57af591

8022051: G1: Remove some unused G1 flags Reviewed-by: tschatzl, jmasa
author brutisso
date Thu, 01 Aug 2013 17:29:49 +0200
parents da91efe96a93
children 1a8fb39bdbc4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
1 /*
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
4 *
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
7 * published by the Free Software Foundation.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
8 *
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
13 * accompanied this code).
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
14 *
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
18 *
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
21 * questions.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
22 *
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
23 */
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
24
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
25 #include "precompiled.hpp"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
26 #include "gc_implementation/g1/g1MonitoringSupport.hpp"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
28 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
29
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
30 G1GenerationCounters::G1GenerationCounters(G1MonitoringSupport* g1mm,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
31 const char* name,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
32 int ordinal, int spaces,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
33 size_t min_capacity,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
34 size_t max_capacity,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
35 size_t curr_capacity)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
36 : GenerationCounters(name, ordinal, spaces, min_capacity,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
37 max_capacity, curr_capacity), _g1mm(g1mm) { }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
38
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
39 // We pad the capacity three times given that the young generation
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
40 // contains three spaces (eden and two survivors).
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
41 G1YoungGenerationCounters::G1YoungGenerationCounters(G1MonitoringSupport* g1mm,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
42 const char* name)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
43 : G1GenerationCounters(g1mm, name, 0 /* ordinal */, 3 /* spaces */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
44 G1MonitoringSupport::pad_capacity(0, 3) /* min_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
45 G1MonitoringSupport::pad_capacity(g1mm->young_gen_max(), 3),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
46 G1MonitoringSupport::pad_capacity(0, 3) /* curr_capacity */) {
5916
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
47 if (UsePerfData) {
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
48 update_all();
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
49 }
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
50 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
51
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
52 G1OldGenerationCounters::G1OldGenerationCounters(G1MonitoringSupport* g1mm,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
53 const char* name)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
54 : G1GenerationCounters(g1mm, name, 1 /* ordinal */, 1 /* spaces */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
55 G1MonitoringSupport::pad_capacity(0) /* min_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
56 G1MonitoringSupport::pad_capacity(g1mm->old_gen_max()),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
57 G1MonitoringSupport::pad_capacity(0) /* curr_capacity */) {
5916
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
58 if (UsePerfData) {
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
59 update_all();
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
60 }
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
61 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
62
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
63 void G1YoungGenerationCounters::update_all() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
64 size_t committed =
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
65 G1MonitoringSupport::pad_capacity(_g1mm->young_gen_committed(), 3);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
66 _current_size->set_value(committed);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
67 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
68
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
69 void G1OldGenerationCounters::update_all() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
70 size_t committed =
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
71 G1MonitoringSupport::pad_capacity(_g1mm->old_gen_committed());
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
72 _current_size->set_value(committed);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
73 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
74
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
75 G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h) :
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
76 _g1h(g1h),
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
77 _incremental_collection_counters(NULL),
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
78 _full_collection_counters(NULL),
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
79 _old_collection_counters(NULL),
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
80 _old_space_counters(NULL),
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
81 _young_collection_counters(NULL),
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
82 _eden_counters(NULL),
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
83 _from_counters(NULL),
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
84 _to_counters(NULL),
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
85
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
86 _overall_reserved(0),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
87 _overall_committed(0), _overall_used(0),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
88 _young_region_num(0),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
89 _young_gen_committed(0),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
90 _eden_committed(0), _eden_used(0),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
91 _survivor_committed(0), _survivor_used(0),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
92 _old_committed(0), _old_used(0) {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
93
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
94 _overall_reserved = g1h->max_capacity();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
95 recalculate_sizes();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
96
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
97 // Counters for GC collections
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
98 //
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
99 // name "collector.0". In a generational collector this would be the
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
100 // young generation collection.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
101 _incremental_collection_counters =
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
102 new CollectorCounters("G1 incremental collections", 0);
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
103 // name "collector.1". In a generational collector this would be the
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
104 // old generation collection.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
105 _full_collection_counters =
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
106 new CollectorCounters("G1 stop-the-world full collections", 1);
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
107
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
108 // timer sampling for all counters supporting sampling only update the
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
109 // used value. See the take_sample() method. G1 requires both used and
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
110 // capacity updated so sampling is not currently used. It might
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
111 // be sufficient to update all counters in take_sample() even though
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
112 // take_sample() only returns "used". When sampling was used, there
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
113 // were some anomolous values emitted which may have been the consequence
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
114 // of not updating all values simultaneously (i.e., see the calculation done
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
115 // in eden_space_used(), is it possbile that the values used to
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
116 // calculate either eden_used or survivor_used are being updated by
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
117 // the collector when the sample is being done?).
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
118 const bool sampled = false;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
119
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
120 // "Generation" and "Space" counters.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
121 //
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
122 // name "generation.1" This is logically the old generation in
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
123 // generational GC terms. The "1, 1" parameters are for
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
124 // the n-th generation (=1) with 1 space.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
125 // Counters are created from minCapacity, maxCapacity, and capacity
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
126 _old_collection_counters = new G1OldGenerationCounters(this, "old");
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
127
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
128 // name "generation.1.space.0"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
129 // Counters are created from maxCapacity, capacity, initCapacity,
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
130 // and used.
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
131 _old_space_counters = new HSpaceCounters("space", 0 /* ordinal */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
132 pad_capacity(overall_reserved()) /* max_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
133 pad_capacity(old_space_committed()) /* init_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
134 _old_collection_counters);
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
135
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
136 // Young collection set
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
137 // name "generation.0". This is logically the young generation.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
138 // The "0, 3" are paremeters for the n-th genertaion (=0) with 3 spaces.
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
139 // See _old_collection_counters for additional counters
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
140 _young_collection_counters = new G1YoungGenerationCounters(this, "young");
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
141
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
142 // name "generation.0.space.0"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
143 // See _old_space_counters for additional counters
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
144 _eden_counters = new HSpaceCounters("eden", 0 /* ordinal */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
145 pad_capacity(overall_reserved()) /* max_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
146 pad_capacity(eden_space_committed()) /* init_capacity */,
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
147 _young_collection_counters);
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
148
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
149 // name "generation.0.space.1"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
150 // See _old_space_counters for additional counters
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
151 // Set the arguments to indicate that this survivor space is not used.
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
152 _from_counters = new HSpaceCounters("s0", 1 /* ordinal */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
153 pad_capacity(0) /* max_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
154 pad_capacity(0) /* init_capacity */,
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
155 _young_collection_counters);
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
156
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
157 // name "generation.0.space.2"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
158 // See _old_space_counters for additional counters
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
159 _to_counters = new HSpaceCounters("s1", 2 /* ordinal */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
160 pad_capacity(overall_reserved()) /* max_capacity */,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
161 pad_capacity(survivor_space_committed()) /* init_capacity */,
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
162 _young_collection_counters);
5916
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
163
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
164 if (UsePerfData) {
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
165 // Given that this survivor space is not used, we update it here
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
166 // once to reflect that its used space is 0 so that we don't have to
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
167 // worry about updating it again later.
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
168 _from_counters->update_used(0);
b5290bf0a9e4 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
johnc
parents: 3980
diff changeset
169 }
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
170 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
171
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
172 void G1MonitoringSupport::recalculate_sizes() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
173 G1CollectedHeap* g1 = g1h();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
174
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
175 // Recalculate all the sizes from scratch. We assume that this is
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
176 // called at a point where no concurrent updates to the various
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
177 // values we read here are possible (i.e., at a STW phase at the end
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
178 // of a GC).
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
179
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
180 uint young_list_length = g1->young_list()->length();
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
181 uint survivor_list_length = g1->g1_policy()->recorded_survivor_regions();
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
182 assert(young_list_length >= survivor_list_length, "invariant");
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
183 uint eden_list_length = young_list_length - survivor_list_length;
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
184 // Max length includes any potential extensions to the young gen
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
185 // we'll do when the GC locker is active.
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
186 uint young_list_max_length = g1->g1_policy()->young_list_max_length();
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
187 assert(young_list_max_length >= survivor_list_length, "invariant");
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
188 uint eden_list_max_length = young_list_max_length - survivor_list_length;
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
189
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
190 _overall_used = g1->used_unlocked();
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
191 _eden_used = (size_t) eden_list_length * HeapRegion::GrainBytes;
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
192 _survivor_used = (size_t) survivor_list_length * HeapRegion::GrainBytes;
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
193 _young_region_num = young_list_length;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
194 _old_used = subtract_up_to_zero(_overall_used, _eden_used + _survivor_used);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
195
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
196 // First calculate the committed sizes that can be calculated independently.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
197 _survivor_committed = _survivor_used;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
198 _old_committed = HeapRegion::align_up_to_region_byte_size(_old_used);
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
199
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
200 // Next, start with the overall committed size.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
201 _overall_committed = g1->capacity();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
202 size_t committed = _overall_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
203
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
204 // Remove the committed size we have calculated so far (for the
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
205 // survivor and old space).
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
206 assert(committed >= (_survivor_committed + _old_committed), "sanity");
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
207 committed -= _survivor_committed + _old_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
208
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
209 // Next, calculate and remove the committed size for the eden.
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
210 _eden_committed = (size_t) eden_list_max_length * HeapRegion::GrainBytes;
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
211 // Somewhat defensive: be robust in case there are inaccuracies in
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
212 // the calculations
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
213 _eden_committed = MIN2(_eden_committed, committed);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
214 committed -= _eden_committed;
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
215
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
216 // Finally, give the rest to the old space...
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
217 _old_committed += committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
218 // ..and calculate the young gen committed.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
219 _young_gen_committed = _eden_committed + _survivor_committed;
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
220
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
221 assert(_overall_committed ==
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
222 (_eden_committed + _survivor_committed + _old_committed),
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
223 "the committed sizes should add up");
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
224 // Somewhat defensive: cap the eden used size to make sure it
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
225 // never exceeds the committed size.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
226 _eden_used = MIN2(_eden_used, _eden_committed);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
227 // _survivor_committed and _old_committed are calculated in terms of
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
228 // the corresponding _*_used value, so the next two conditions
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
229 // should hold.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
230 assert(_survivor_used <= _survivor_committed, "post-condition");
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
231 assert(_old_used <= _old_committed, "post-condition");
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
232 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
233
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
234 void G1MonitoringSupport::recalculate_eden_size() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
235 G1CollectedHeap* g1 = g1h();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
236
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
237 // When a new eden region is allocated, only the eden_used size is
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
238 // affected (since we have recalculated everything else at the last GC).
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
239
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
240 uint young_region_num = g1h()->young_list()->length();
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
241 if (young_region_num > _young_region_num) {
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
242 uint diff = young_region_num - _young_region_num;
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 5916
diff changeset
243 _eden_used += (size_t) diff * HeapRegion::GrainBytes;
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
244 // Somewhat defensive: cap the eden used size to make sure it
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
245 // never exceeds the committed size.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
246 _eden_used = MIN2(_eden_used, _eden_committed);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
247 _young_region_num = young_region_num;
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
248 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
249 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
250
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
251 void G1MonitoringSupport::update_sizes() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
252 recalculate_sizes();
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
253 if (UsePerfData) {
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
254 eden_counters()->update_capacity(pad_capacity(eden_space_committed()));
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
255 eden_counters()->update_used(eden_space_used());
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
256 // only the to survivor space (s1) is active, so we don't need to
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
257 // update the counteres for the from survivor space (s0)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
258 to_counters()->update_capacity(pad_capacity(survivor_space_committed()));
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
259 to_counters()->update_used(survivor_space_used());
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
260 old_space_counters()->update_capacity(pad_capacity(old_space_committed()));
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
261 old_space_counters()->update_used(old_space_used());
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
262 old_collection_counters()->update_all();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
263 young_collection_counters()->update_all();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6010
diff changeset
264 MetaspaceCounters::update_performance_counters();
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
265 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
266 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
267
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
268 void G1MonitoringSupport::update_eden_size() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
269 recalculate_eden_size();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
270 if (UsePerfData) {
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
271 eden_counters()->update_used(eden_space_used());
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
272 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
273 }