Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.cpp
41149 views
1
/*
2
* Copyright (c) 2003, 2021, 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
#include "precompiled.hpp"
26
#include "gc/parallel/psGCAdaptivePolicyCounters.hpp"
27
#include "memory/resourceArea.hpp"
28
29
PSGCAdaptivePolicyCounters::PSGCAdaptivePolicyCounters(const char* name_arg,
30
int collectors,
31
int generations,
32
PSAdaptiveSizePolicy* size_policy_arg)
33
: GCAdaptivePolicyCounters(name_arg,
34
collectors,
35
generations,
36
size_policy_arg) {
37
if (UsePerfData) {
38
EXCEPTION_MARK;
39
ResourceMark rm;
40
41
const char* cname;
42
43
cname = PerfDataManager::counter_name(name_space(), "oldPromoSize");
44
_old_promo_size = PerfDataManager::create_variable(SUN_GC, cname,
45
PerfData::U_Bytes, ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
46
47
cname = PerfDataManager::counter_name(name_space(), "oldEdenSize");
48
_old_eden_size = PerfDataManager::create_variable(SUN_GC, cname,
49
PerfData::U_Bytes, ps_size_policy()->calculated_eden_size_in_bytes(), CHECK);
50
51
cname = PerfDataManager::counter_name(name_space(), "oldCapacity");
52
_old_capacity = PerfDataManager::create_variable(SUN_GC, cname,
53
PerfData::U_Bytes, (jlong) InitialHeapSize, CHECK);
54
55
cname = PerfDataManager::counter_name(name_space(), "avgPromotedAvg");
56
_avg_promoted_avg_counter =
57
PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
58
ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
59
60
cname = PerfDataManager::counter_name(name_space(), "avgPromotedDev");
61
_avg_promoted_dev_counter =
62
PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
63
(jlong) 0 , CHECK);
64
65
cname = PerfDataManager::counter_name(name_space(), "avgPromotedPaddedAvg");
66
_avg_promoted_padded_avg_counter =
67
PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
68
ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
69
70
cname = PerfDataManager::counter_name(name_space(),
71
"avgPretenuredPaddedAvg");
72
_avg_pretenured_padded_avg =
73
PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
74
(jlong) 0, CHECK);
75
76
77
cname = PerfDataManager::counter_name(name_space(),
78
"changeYoungGenForMajPauses");
79
_change_young_gen_for_maj_pauses_counter =
80
PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
81
(jlong)0, CHECK);
82
83
cname = PerfDataManager::counter_name(name_space(),
84
"changeOldGenForMinPauses");
85
_change_old_gen_for_min_pauses =
86
PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
87
(jlong)0, CHECK);
88
89
90
cname = PerfDataManager::counter_name(name_space(), "avgMajorPauseTime");
91
_avg_major_pause = PerfDataManager::create_variable(SUN_GC, cname,
92
PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_pause->average(), CHECK);
93
94
cname = PerfDataManager::counter_name(name_space(), "avgMajorIntervalTime");
95
_avg_major_interval = PerfDataManager::create_variable(SUN_GC, cname,
96
PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_interval->average(), CHECK);
97
98
cname = PerfDataManager::counter_name(name_space(), "majorGcCost");
99
_major_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, cname,
100
PerfData::U_Ticks, (jlong) ps_size_policy()->major_gc_cost(), CHECK);
101
102
cname = PerfDataManager::counter_name(name_space(), "liveSpace");
103
_live_space = PerfDataManager::create_variable(SUN_GC, cname,
104
PerfData::U_Bytes, ps_size_policy()->live_space(), CHECK);
105
106
cname = PerfDataManager::counter_name(name_space(), "freeSpace");
107
_free_space = PerfDataManager::create_variable(SUN_GC, cname,
108
PerfData::U_Bytes, ps_size_policy()->free_space(), CHECK);
109
110
cname = PerfDataManager::counter_name(name_space(), "avgBaseFootprint");
111
_avg_base_footprint = PerfDataManager::create_variable(SUN_GC, cname,
112
PerfData::U_Bytes, (jlong) ps_size_policy()->avg_base_footprint()->average(), CHECK);
113
114
cname = PerfDataManager::counter_name(name_space(), "liveAtLastFullGc");
115
_live_at_last_full_gc_counter =
116
PerfDataManager::create_variable(SUN_GC, cname,
117
PerfData::U_Bytes, ps_size_policy()->live_at_last_full_gc(), CHECK);
118
119
cname = PerfDataManager::counter_name(name_space(), "majorPauseOldSlope");
120
_major_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
121
PerfData::U_None, (jlong) 0, CHECK);
122
123
cname = PerfDataManager::counter_name(name_space(), "minorPauseOldSlope");
124
_minor_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
125
PerfData::U_None, (jlong) 0, CHECK);
126
127
cname = PerfDataManager::counter_name(name_space(), "majorPauseYoungSlope");
128
_major_pause_young_slope = PerfDataManager::create_variable(SUN_GC, cname,
129
PerfData::U_None, (jlong) 0, CHECK);
130
131
cname = PerfDataManager::counter_name(name_space(), "scavengeSkipped");
132
_scavenge_skipped = PerfDataManager::create_variable(SUN_GC, cname,
133
PerfData::U_Bytes, (jlong) 0, CHECK);
134
135
cname = PerfDataManager::counter_name(name_space(), "fullFollowsScavenge");
136
_full_follows_scavenge = PerfDataManager::create_variable(SUN_GC, cname,
137
PerfData::U_Bytes, (jlong) 0, CHECK);
138
139
_counter_time_stamp.update();
140
}
141
142
assert(size_policy()->is_gc_ps_adaptive_size_policy(),
143
"Wrong type of size policy");
144
}
145
146
void PSGCAdaptivePolicyCounters::update_counters_from_policy() {
147
if (UsePerfData) {
148
GCAdaptivePolicyCounters::update_counters_from_policy();
149
update_eden_size();
150
update_promo_size();
151
update_avg_old_live();
152
update_survivor_size_counters();
153
update_avg_promoted_avg();
154
update_avg_promoted_dev();
155
update_avg_promoted_padded_avg();
156
update_avg_pretenured_padded_avg();
157
158
update_avg_major_pause();
159
update_avg_major_interval();
160
update_minor_gc_cost_counter();
161
update_major_gc_cost_counter();
162
update_mutator_cost_counter();
163
update_decrement_tenuring_threshold_for_gc_cost();
164
update_increment_tenuring_threshold_for_gc_cost();
165
update_decrement_tenuring_threshold_for_survivor_limit();
166
update_live_space();
167
update_free_space();
168
update_avg_base_footprint();
169
170
update_change_old_gen_for_maj_pauses();
171
update_change_young_gen_for_maj_pauses();
172
update_change_old_gen_for_min_pauses();
173
174
update_change_old_gen_for_throughput();
175
update_change_young_gen_for_throughput();
176
177
update_decrease_for_footprint();
178
update_decide_at_full_gc_counter();
179
180
update_major_pause_old_slope();
181
update_minor_pause_old_slope();
182
update_major_pause_young_slope();
183
update_minor_collection_slope_counter();
184
update_gc_overhead_limit_exceeded_counter();
185
update_live_at_last_full_gc_counter();
186
}
187
}
188
189
void PSGCAdaptivePolicyCounters::update_counters() {
190
if (UsePerfData) {
191
update_counters_from_policy();
192
}
193
}
194
195