1 /*
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
60 update_all();
61 }
62 }
63
64 void G1YoungGenerationCounters::update_all() {
65 size_t committed =
66 G1MonitoringSupport::pad_capacity(_g1mm->young_gen_committed(), 3);
67 _current_size->set_value(committed);
68 }
69
70 void G1OldGenerationCounters::update_all() {
71 size_t committed =
72 G1MonitoringSupport::pad_capacity(_g1mm->old_gen_committed());
73 _current_size->set_value(committed);
74 }
75
76 G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h) :
77 _g1h(g1h),
78 _incremental_collection_counters(NULL),
79 _full_collection_counters(NULL),
80 _old_collection_counters(NULL),
81 _old_space_counters(NULL),
82 _young_collection_counters(NULL),
83 _eden_counters(NULL),
84 _from_counters(NULL),
85 _to_counters(NULL),
86
87 _overall_reserved(0),
88 _overall_committed(0), _overall_used(0),
89 _young_region_num(0),
90 _young_gen_committed(0),
91 _eden_committed(0), _eden_used(0),
92 _survivor_committed(0), _survivor_used(0),
93 _old_committed(0), _old_used(0) {
94
95 _overall_reserved = g1h->max_capacity();
96 recalculate_sizes();
97
98 // Counters for GC collections
99 //
100 // name "collector.0". In a generational collector this would be the
101 // young generation collection.
102 _incremental_collection_counters =
103 new CollectorCounters("G1 incremental collections", 0);
104 // name "collector.1". In a generational collector this would be the
105 // old generation collection.
106 _full_collection_counters =
107 new CollectorCounters("G1 stop-the-world full collections", 1);
108
109 // timer sampling for all counters supporting sampling only update the
110 // used value. See the take_sample() method. G1 requires both used and
111 // capacity updated so sampling is not currently used. It might
112 // be sufficient to update all counters in take_sample() even though
113 // take_sample() only returns "used". When sampling was used, there
114 // were some anomolous values emitted which may have been the consequence
115 // of not updating all values simultaneously (i.e., see the calculation done
116 // in eden_space_used(), is it possible that the values used to
117 // calculate either eden_used or survivor_used are being updated by
118 // the collector when the sample is being done?).
119 const bool sampled = false;
120
121 // "Generation" and "Space" counters.
122 //
123 // name "generation.1" This is logically the old generation in
124 // generational GC terms. The "1, 1" parameters are for
125 // the n-th generation (=1) with 1 space.
126 // Counters are created from minCapacity, maxCapacity, and capacity
127 _old_collection_counters = new G1OldGenerationCounters(this, "old");
|
1 /*
2 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
60 update_all();
61 }
62 }
63
64 void G1YoungGenerationCounters::update_all() {
65 size_t committed =
66 G1MonitoringSupport::pad_capacity(_g1mm->young_gen_committed(), 3);
67 _current_size->set_value(committed);
68 }
69
70 void G1OldGenerationCounters::update_all() {
71 size_t committed =
72 G1MonitoringSupport::pad_capacity(_g1mm->old_gen_committed());
73 _current_size->set_value(committed);
74 }
75
76 G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h) :
77 _g1h(g1h),
78 _incremental_collection_counters(NULL),
79 _full_collection_counters(NULL),
80 _conc_collection_counters(NULL),
81 _old_collection_counters(NULL),
82 _old_space_counters(NULL),
83 _young_collection_counters(NULL),
84 _eden_counters(NULL),
85 _from_counters(NULL),
86 _to_counters(NULL),
87
88 _overall_reserved(0),
89 _overall_committed(0), _overall_used(0),
90 _young_region_num(0),
91 _young_gen_committed(0),
92 _eden_committed(0), _eden_used(0),
93 _survivor_committed(0), _survivor_used(0),
94 _old_committed(0), _old_used(0) {
95
96 _overall_reserved = g1h->max_capacity();
97 recalculate_sizes();
98
99 // Counters for GC collections
100 //
101 // name "collector.0". In a generational collector this would be the
102 // young generation collection.
103 _incremental_collection_counters =
104 new CollectorCounters("G1 incremental collections", 0);
105 // name "collector.1". In a generational collector this would be the
106 // old generation collection.
107 _full_collection_counters =
108 new CollectorCounters("G1 stop-the-world full collections", 1);
109 // name "collector.2". In a generational collector this would be the
110 // STW phases in concurrent collection.
111 _conc_collection_counters =
112 new CollectorCounters("G1 stop-the-world phases", 2);
113
114 // timer sampling for all counters supporting sampling only update the
115 // used value. See the take_sample() method. G1 requires both used and
116 // capacity updated so sampling is not currently used. It might
117 // be sufficient to update all counters in take_sample() even though
118 // take_sample() only returns "used". When sampling was used, there
119 // were some anomolous values emitted which may have been the consequence
120 // of not updating all values simultaneously (i.e., see the calculation done
121 // in eden_space_used(), is it possible that the values used to
122 // calculate either eden_used or survivor_used are being updated by
123 // the collector when the sample is being done?).
124 const bool sampled = false;
125
126 // "Generation" and "Space" counters.
127 //
128 // name "generation.1" This is logically the old generation in
129 // generational GC terms. The "1, 1" parameters are for
130 // the n-th generation (=1) with 1 space.
131 // Counters are created from minCapacity, maxCapacity, and capacity
132 _old_collection_counters = new G1OldGenerationCounters(this, "old");
|