Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp
38920 views
1
/*
2
* Copyright (c) 2003, 2013, 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
*
23
*/
24
25
#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP
26
#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP
27
28
#include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
29
#include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp"
30
#include "gc_implementation/shared/gcPolicyCounters.hpp"
31
32
// PSGCAdaptivePolicyCounters is a holder class for performance counters
33
// that track the data and decisions for the ergonomics policy for the
34
// parallel scavenge collector.
35
36
class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
37
friend class VMStructs;
38
39
private:
40
// survivor space vs. tenuring threshold
41
PerfVariable* _old_promo_size;
42
PerfVariable* _old_eden_size;
43
PerfVariable* _avg_promoted_avg_counter;
44
PerfVariable* _avg_promoted_dev_counter;
45
PerfVariable* _avg_promoted_padded_avg_counter;
46
PerfVariable* _avg_pretenured_padded_avg;
47
48
// young gen vs. old gen sizing
49
PerfVariable* _avg_major_pause;
50
PerfVariable* _avg_major_interval;
51
PerfVariable* _live_space;
52
PerfVariable* _free_space;
53
PerfVariable* _avg_base_footprint;
54
PerfVariable* _gc_overhead_limit_exceeded_counter;
55
PerfVariable* _live_at_last_full_gc_counter;
56
PerfVariable* _old_capacity;
57
PerfVariable* _boundary_moved;
58
59
PerfVariable* _change_old_gen_for_min_pauses;
60
PerfVariable* _change_young_gen_for_maj_pauses_counter;
61
62
PerfVariable* _major_pause_old_slope;
63
PerfVariable* _minor_pause_old_slope;
64
PerfVariable* _major_pause_young_slope;
65
66
PerfVariable* _scavenge_skipped;
67
PerfVariable* _full_follows_scavenge;
68
69
// Use this time stamp if the gc time stamp is not available.
70
TimeStamp _counter_time_stamp;
71
72
protected:
73
PSAdaptiveSizePolicy* ps_size_policy() {
74
return (PSAdaptiveSizePolicy*)_size_policy;
75
}
76
77
public:
78
PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,
79
PSAdaptiveSizePolicy* size_policy);
80
inline void update_old_capacity(size_t size_in_bytes) {
81
_old_capacity->set_value(size_in_bytes);
82
}
83
inline void update_old_eden_size(size_t old_size) {
84
_old_eden_size->set_value(old_size);
85
}
86
inline void update_old_promo_size(size_t old_size) {
87
_old_promo_size->set_value(old_size);
88
}
89
inline void update_boundary_moved(int size_in_bytes) {
90
_boundary_moved->set_value(size_in_bytes);
91
}
92
inline void update_avg_promoted_avg() {
93
_avg_promoted_avg_counter->set_value(
94
(jlong)(ps_size_policy()->avg_promoted()->average())
95
);
96
}
97
inline void update_avg_promoted_dev() {
98
_avg_promoted_dev_counter->set_value(
99
(jlong)(ps_size_policy()->avg_promoted()->deviation())
100
);
101
}
102
inline void update_avg_promoted_padded_avg() {
103
_avg_promoted_padded_avg_counter->set_value(
104
(jlong)(ps_size_policy()->avg_promoted()->padded_average())
105
);
106
}
107
108
inline void update_avg_pretenured_padded_avg() {
109
_avg_pretenured_padded_avg->set_value(
110
(jlong)(ps_size_policy()->_avg_pretenured->padded_average())
111
);
112
}
113
inline void update_change_young_gen_for_maj_pauses() {
114
_change_young_gen_for_maj_pauses_counter->set_value(
115
ps_size_policy()->change_young_gen_for_maj_pauses());
116
}
117
inline void update_change_old_gen_for_min_pauses() {
118
_change_old_gen_for_min_pauses->set_value(
119
ps_size_policy()->change_old_gen_for_min_pauses());
120
}
121
122
// compute_generations_free_space() statistics
123
124
inline void update_avg_major_pause() {
125
_avg_major_pause->set_value(
126
(jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0)
127
);
128
}
129
inline void update_avg_major_interval() {
130
_avg_major_interval->set_value(
131
(jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0)
132
);
133
}
134
135
inline void update_major_gc_cost_counter() {
136
_major_gc_cost_counter->set_value(
137
(jlong)(ps_size_policy()->major_gc_cost() * 100.0)
138
);
139
}
140
inline void update_mutator_cost_counter() {
141
_mutator_cost_counter->set_value(
142
(jlong)(ps_size_policy()->mutator_cost() * 100.0)
143
);
144
}
145
146
inline void update_live_space() {
147
_live_space->set_value(ps_size_policy()->live_space());
148
}
149
inline void update_free_space() {
150
_free_space->set_value(ps_size_policy()->free_space());
151
}
152
153
inline void update_avg_base_footprint() {
154
_avg_base_footprint->set_value(
155
(jlong)(ps_size_policy()->avg_base_footprint()->average())
156
);
157
}
158
inline void update_avg_old_live() {
159
_avg_old_live_counter->set_value(
160
(jlong)(ps_size_policy()->avg_old_live()->average())
161
);
162
}
163
// Scale up all the slopes
164
inline void update_major_pause_old_slope() {
165
_major_pause_old_slope->set_value(
166
(jlong)(ps_size_policy()->major_pause_old_slope() * 1000)
167
);
168
}
169
inline void update_minor_pause_old_slope() {
170
_minor_pause_old_slope->set_value(
171
(jlong)(ps_size_policy()->minor_pause_old_slope() * 1000)
172
);
173
}
174
inline void update_major_pause_young_slope() {
175
_major_pause_young_slope->set_value(
176
(jlong)(ps_size_policy()->major_pause_young_slope() * 1000)
177
);
178
}
179
inline void update_gc_overhead_limit_exceeded_counter() {
180
_gc_overhead_limit_exceeded_counter->set_value(
181
(jlong) ps_size_policy()->gc_overhead_limit_exceeded());
182
}
183
inline void update_live_at_last_full_gc_counter() {
184
_live_at_last_full_gc_counter->set_value(
185
(jlong)(ps_size_policy()->live_at_last_full_gc()));
186
}
187
188
inline void update_scavenge_skipped(int cause) {
189
_scavenge_skipped->set_value(cause);
190
}
191
192
inline void update_full_follows_scavenge(int event) {
193
_full_follows_scavenge->set_value(event);
194
}
195
196
// Update all the counters that can be updated from the size policy.
197
// This should be called after all policy changes have been made
198
// and reflected internall in the size policy.
199
void update_counters_from_policy();
200
201
// Update counters that can be updated from fields internal to the
202
// counter or from globals. This is distinguished from counters
203
// that are updated via input parameters.
204
void update_counters();
205
206
virtual GCPolicyCounters::Name kind() const {
207
return GCPolicyCounters::PSGCAdaptivePolicyCountersKind;
208
}
209
};
210
211
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP
212
213