annotate src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp @ 8733:9def4075da6d

8008079: G1: Add nextObject routine to CMBitMapRO and replace nextWord Summary: Update the task local finger to the start of the next object when marking aborts, in order to avoid the redundant scanning of all 0's when the marking task restarts, if otherwise updating to the next word. In addition, reuse the routine nextObject() in routine iterate(). Reviewed-by: johnc, ysr Contributed-by: tamao <tao.mao@oracle.com>
author tamao
date Tue, 05 Mar 2013 15:36:56 -0800
parents d2a62e0f25eb
children f2110083203d
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: 4832
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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
27
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
28 #include "gc_implementation/shared/hSpaceCounters.hpp"
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
29
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
30 class G1CollectedHeap;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
31
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
32 // Class for monitoring logical spaces in G1. It provides data for
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
33 // both G1's jstat counters as well as G1's memory pools.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
34 //
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
35 // G1 splits the heap into heap regions and each heap region belongs
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
36 // to one of the following categories:
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
37 //
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
38 // * eden : regions that have been allocated since the last GC
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
39 // * survivors : regions with objects that survived the last few GCs
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
40 // * old : long-lived non-humongous regions
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
41 // * humongous : humongous regions
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
42 // * free : free regions
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
43 //
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
44 // The combination of eden and survivor regions form the equivalent of
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
45 // the young generation in the other GCs. The combination of old and
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
46 // humongous regions form the equivalent of the old generation in the
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
47 // other GCs. Free regions do not have a good equivalent in the other
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
48 // GCs given that they can be allocated as any of the other region types.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
49 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
50 // The monitoring tools expect the heap to contain a number of
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
51 // generations (young, old, perm) and each generation to contain a
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
52 // number of spaces (young: eden, survivors, old). Given that G1 does
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
53 // not maintain those spaces physically (e.g., the set of
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
54 // non-contiguous eden regions can be considered as a "logical"
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
55 // space), we'll provide the illusion that those generations and
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
56 // spaces exist. In reality, each generation and space refers to a set
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
57 // of heap regions that are potentially non-contiguous.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
58 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
59 // This class provides interfaces to access the min, current, and max
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
60 // capacity and current occupancy for each of G1's logical spaces and
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
61 // generations we expose to the monitoring tools. Also provided are
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
62 // counters for G1 concurrent collections and stop-the-world full heap
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
63 // collections.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
64 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
65 // Below is a description of how the various sizes are calculated.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
66 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
67 // * Current Capacity
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
68 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
69 // - heap_capacity = current heap capacity (e.g., current committed size)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
70 // - young_gen_capacity = current max young gen target capacity
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
71 // (i.e., young gen target capacity + max allowed expansion capacity)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
72 // - survivor_capacity = current survivor region capacity
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
73 // - eden_capacity = young_gen_capacity - survivor_capacity
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
74 // - old_capacity = heap_capacity - young_gen_capacity
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
75 //
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
76 // What we do in the above is to distribute the free regions among
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
77 // eden_capacity and old_capacity.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
78 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
79 // * Occupancy
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
80 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
81 // - young_gen_used = current young region capacity
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
82 // - survivor_used = survivor_capacity
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
83 // - eden_used = young_gen_used - survivor_used
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
84 // - old_used = overall_used - young_gen_used
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
85 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
86 // Unfortunately, we currently only keep track of the number of
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
87 // currently allocated young and survivor regions + the overall used
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
88 // bytes in the heap, so the above can be a little inaccurate.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
89 //
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
90 // * Min Capacity
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
91 //
4832
a8a126788ea0 7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents: 4710
diff changeset
92 // We set this to 0 for all spaces.
3980
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 // * Max Capacity
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
95 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
96 // For jstat, we set the max capacity of all spaces to heap_capacity,
4832
a8a126788ea0 7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents: 4710
diff changeset
97 // given that we don't always have a reasonable upper bound on how big
a8a126788ea0 7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents: 4710
diff changeset
98 // each space can grow. For the memory pools, we make the max
a8a126788ea0 7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents: 4710
diff changeset
99 // capacity undefined with the exception of the old memory pool for
a8a126788ea0 7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents: 4710
diff changeset
100 // which we make the max capacity same as the max heap capacity.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
101 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
102 // If we had more accurate occupancy / capacity information per
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
103 // region set the above calculations would be greatly simplified and
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
104 // be made more accurate.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
105 //
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
106 // We update all the above synchronously and we store the results in
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
107 // fields so that we just read said fields when needed. A subtle point
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
108 // is that all the above sizes need to be recalculated when the old
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
109 // gen changes capacity (after a GC or after a humongous allocation)
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
110 // but only the eden occupancy changes when a new eden region is
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
111 // allocated. So, in the latter case we have minimal recalcuation to
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
112 // do which is important as we want to keep the eden region allocation
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
113 // path as low-overhead as possible.
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
114
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6010
diff changeset
115 class G1MonitoringSupport : public CHeapObj<mtGC> {
3984
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents: 3980
diff changeset
116 friend class VMStructs;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents: 3980
diff changeset
117
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
118 G1CollectedHeap* _g1h;
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 // jstat performance counters
4710
41406797186b 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 3984
diff changeset
121 // incremental collections both young and mixed
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
122 CollectorCounters* _incremental_collection_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
123 // full stop-the-world collections
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
124 CollectorCounters* _full_collection_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
125 // young collection set counters. The _eden_counters,
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
126 // _from_counters, and _to_counters are associated with
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
127 // this "generational" counter.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
128 GenerationCounters* _young_collection_counters;
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
129 // old collection set counters. The _old_space_counters
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
130 // below are associated with this "generational" counter.
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
131 GenerationCounters* _old_collection_counters;
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
132 // Counters for the capacity and used for
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
133 // the whole heap
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
134 HSpaceCounters* _old_space_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
135 // the young collection
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
136 HSpaceCounters* _eden_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
137 // the survivor collection (only one, _to_counters, is actively used)
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
138 HSpaceCounters* _from_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
139 HSpaceCounters* _to_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
140
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
141 // When it's appropriate to recalculate the various sizes (at the
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
142 // end of a GC, when a new eden region is allocated, etc.) we store
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
143 // them here so that we can easily report them when needed and not
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
144 // have to recalculate them every time.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
145
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
146 size_t _overall_reserved;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
147 size_t _overall_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
148 size_t _overall_used;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
149
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 4832
diff changeset
150 uint _young_region_num;
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
151 size_t _young_gen_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
152 size_t _eden_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
153 size_t _eden_used;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
154 size_t _survivor_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
155 size_t _survivor_used;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
156
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
157 size_t _old_committed;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
158 size_t _old_used;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
159
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
160 G1CollectedHeap* g1h() { return _g1h; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
161
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
162 // It returns x - y if x > y, 0 otherwise.
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
163 // As described in the comment above, some of the inputs to the
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
164 // calculations we have to do are obtained concurrently and hence
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
165 // may be inconsistent with each other. So, this provides a
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
166 // defensive way of performing the subtraction and avoids the value
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
167 // going negative (which would mean a very large result, given that
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
168 // the parameter are size_t).
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
169 static size_t subtract_up_to_zero(size_t x, size_t y) {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
170 if (x > y) {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
171 return x - y;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
172 } else {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
173 return 0;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
174 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
175 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
176
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
177 // Recalculate all the sizes.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
178 void recalculate_sizes();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
179 // Recalculate only what's necessary when a new eden region is allocated.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
180 void recalculate_eden_size();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
181
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
182 public:
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
183 G1MonitoringSupport(G1CollectedHeap* g1h);
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
184
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
185 // Unfortunately, the jstat tool assumes that no space has 0
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
186 // capacity. In our case, given that each space is logical, it's
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
187 // possible that no regions will be allocated to it, hence to have 0
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
188 // capacity (e.g., if there are no survivor regions, the survivor
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
189 // space has 0 capacity). The way we deal with this is to always pad
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
190 // each capacity value we report to jstat by a very small amount to
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
191 // make sure that it's never zero. Given that we sometimes have to
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
192 // report a capacity of a generation that contains several spaces
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
193 // (e.g., young gen includes one eden, two survivor spaces), the
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
194 // mult parameter is provided in order to adding the appropriate
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
195 // padding multiple times so that the capacities add up correctly.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
196 static size_t pad_capacity(size_t size_bytes, size_t mult = 1) {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
197 return size_bytes + MinObjAlignmentInBytes * mult;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
198 }
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 // Recalculate all the sizes from scratch and update all the jstat
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
201 // counters accordingly.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
202 void update_sizes();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
203 // Recalculate only what's necessary when a new eden region is
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
204 // allocated and update any jstat counters that need to be updated.
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
205 void update_eden_size();
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
206
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
207 CollectorCounters* incremental_collection_counters() {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
208 return _incremental_collection_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
209 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
210 CollectorCounters* full_collection_counters() {
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
211 return _full_collection_counters;
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
212 }
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
213 GenerationCounters* young_collection_counters() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
214 return _young_collection_counters;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
215 }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
216 GenerationCounters* old_collection_counters() {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
217 return _old_collection_counters;
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
218 }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
219 HSpaceCounters* old_space_counters() { return _old_space_counters; }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
220 HSpaceCounters* eden_counters() { return _eden_counters; }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
221 HSpaceCounters* from_counters() { return _from_counters; }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
222 HSpaceCounters* to_counters() { return _to_counters; }
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
223
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
224 // Monitoring support used by
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
225 // MemoryService
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
226 // jstat counters
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
227
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
228 size_t overall_reserved() { return _overall_reserved; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
229 size_t overall_committed() { return _overall_committed; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
230 size_t overall_used() { return _overall_used; }
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
231
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
232 size_t young_gen_committed() { return _young_gen_committed; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
233 size_t young_gen_max() { return overall_reserved(); }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
234 size_t eden_space_committed() { return _eden_committed; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
235 size_t eden_space_used() { return _eden_used; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
236 size_t survivor_space_committed() { return _survivor_committed; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
237 size_t survivor_space_used() { return _survivor_used; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
238
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
239 size_t old_gen_committed() { return old_space_committed(); }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
240 size_t old_gen_max() { return overall_reserved(); }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
241 size_t old_space_committed() { return _old_committed; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
242 size_t old_space_used() { return _old_used; }
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
243 };
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
244
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
245 class G1GenerationCounters: public GenerationCounters {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
246 protected:
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
247 G1MonitoringSupport* _g1mm;
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
248
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
249 public:
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
250 G1GenerationCounters(G1MonitoringSupport* g1mm,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
251 const char* name, int ordinal, int spaces,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
252 size_t min_capacity, size_t max_capacity,
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
253 size_t curr_capacity);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
254 };
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
255
3980
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
256 class G1YoungGenerationCounters: public G1GenerationCounters {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
257 public:
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
258 G1YoungGenerationCounters(G1MonitoringSupport* g1mm, const char* name);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
259 virtual void update_all();
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
260 };
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
261
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
262 class G1OldGenerationCounters: public G1GenerationCounters {
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
263 public:
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
264 G1OldGenerationCounters(G1MonitoringSupport* g1mm, const char* name);
8229bd737950 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 3289
diff changeset
265 virtual void update_all();
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
266 };
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
267
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
268 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP