author | tschatzl |
Fri, 29 Nov 2019 10:20:14 +0100 | |
changeset 59319 | 9ee940f1de90 |
parent 58798 | 08e78887ff96 |
child 59320 | 11ff4e485670 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49643
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
1374 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5350
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5350
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5350
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49643
diff
changeset
|
25 |
#ifndef SHARE_GC_G1_G1ANALYTICS_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49643
diff
changeset
|
26 |
#define SHARE_GC_G1_G1ANALYTICS_HPP |
7397 | 27 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
28 |
#include "memory/allocation.hpp" |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
29 |
#include "utilities/globalDefinitions.hpp" |
1374 | 30 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
31 |
class TruncatedSeq; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
32 |
class G1Predictions; |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
34132
diff
changeset
|
33 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
34 |
class G1Analytics: public CHeapObj<mtGC> { |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
35 |
const static int TruncatedSeqLength = 10; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
36 |
const static int NumPrevPausesForHeuristics = 10; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
37 |
const G1Predictions* _predictor; |
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3191
diff
changeset
|
38 |
|
1374 | 39 |
// These exclude marking times. |
40 |
TruncatedSeq* _recent_gc_times_ms; |
|
41 |
||
42 |
TruncatedSeq* _concurrent_mark_remark_times_ms; |
|
43 |
TruncatedSeq* _concurrent_mark_cleanup_times_ms; |
|
44 |
||
45 |
TruncatedSeq* _alloc_rate_ms_seq; |
|
46 |
double _prev_collection_pause_end_ms; |
|
47 |
||
48 |
TruncatedSeq* _rs_length_diff_seq; |
|
58508
d6058bd73982
8231153: Improve concurrent refinement statistics
kbarrett
parents:
57953
diff
changeset
|
49 |
TruncatedSeq* _concurrent_refine_rate_ms_seq; |
d6058bd73982
8231153: Improve concurrent refinement statistics
kbarrett
parents:
57953
diff
changeset
|
50 |
TruncatedSeq* _logged_cards_rate_ms_seq; |
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
51 |
// The ratio between the number of merged cards and actually scanned cards, for |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
52 |
// young-only and mixed gcs. |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
53 |
TruncatedSeq* _young_card_merge_to_scan_ratio_seq; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
54 |
TruncatedSeq* _mixed_card_merge_to_scan_ratio_seq; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
55 |
|
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
56 |
// The cost to scan a card during young-only and mixed gcs in ms. |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
57 |
TruncatedSeq* _young_cost_per_card_scan_ms_seq; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
58 |
TruncatedSeq* _mixed_cost_per_card_scan_ms_seq; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
59 |
|
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
60 |
// The cost to merge a card during young-only and mixed gcs in ms. |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
61 |
TruncatedSeq* _young_cost_per_card_merge_ms_seq; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
62 |
TruncatedSeq* _mixed_cost_per_card_merge_ms_seq; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
63 |
|
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
64 |
// The cost to copy a byte in ms. |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
65 |
TruncatedSeq* _copy_cost_per_byte_ms_seq; |
1374 | 66 |
TruncatedSeq* _constant_other_time_ms_seq; |
67 |
TruncatedSeq* _young_other_cost_per_region_ms_seq; |
|
68 |
TruncatedSeq* _non_young_other_cost_per_region_ms_seq; |
|
69 |
||
70 |
TruncatedSeq* _pending_cards_seq; |
|
57663
bf8e76d86d05
8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents:
55510
diff
changeset
|
71 |
TruncatedSeq* _rs_length_seq; |
1374 | 72 |
|
73 |
TruncatedSeq* _cost_per_byte_ms_during_cm_seq; |
|
74 |
||
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
75 |
// Statistics kept per GC stoppage, pause or full. |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
76 |
TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec; |
1374 | 77 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
78 |
// The ratio of gc time to elapsed time, computed over recent pauses, |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
79 |
// and the ratio for just the last pause. |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
80 |
double _recent_avg_pause_time_ratio; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
81 |
double _last_pause_time_ratio; |
13288
331d5b6725f3
7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
12781
diff
changeset
|
82 |
|
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
83 |
// Returns whether the sequence have enough samples to get a "good" prediction. |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
84 |
// The constant used is random but "small". |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
85 |
bool enough_samples_available(TruncatedSeq const* seq) const; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
86 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
87 |
double get_new_prediction(TruncatedSeq const* seq) const; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
88 |
size_t get_new_size_prediction(TruncatedSeq const* seq) const; |
1374 | 89 |
|
90 |
public: |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
91 |
G1Analytics(const G1Predictions* predictor); |
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
92 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
93 |
double prev_collection_pause_end_ms() const { |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
94 |
return _prev_collection_pause_end_ms; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
95 |
} |
1374 | 96 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
97 |
double recent_avg_pause_time_ratio() const { |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
98 |
return _recent_avg_pause_time_ratio; |
1374 | 99 |
} |
100 |
||
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
101 |
double last_pause_time_ratio() const { |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
102 |
return _last_pause_time_ratio; |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
103 |
} |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
104 |
|
37144
b7ae74d4d5d8
8151808: Factor G1 heap sizing code out of the G1CollectorPolicy
mgerdin
parents:
37134
diff
changeset
|
105 |
uint number_of_recorded_pause_times() const { |
b7ae74d4d5d8
8151808: Factor G1 heap sizing code out of the G1CollectorPolicy
mgerdin
parents:
37134
diff
changeset
|
106 |
return NumPrevPausesForHeuristics; |
b7ae74d4d5d8
8151808: Factor G1 heap sizing code out of the G1CollectorPolicy
mgerdin
parents:
37134
diff
changeset
|
107 |
} |
b7ae74d4d5d8
8151808: Factor G1 heap sizing code out of the G1CollectorPolicy
mgerdin
parents:
37134
diff
changeset
|
108 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
109 |
void append_prev_collection_pause_end_ms(double ms) { |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
110 |
_prev_collection_pause_end_ms += ms; |
1374 | 111 |
} |
112 |
||
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
113 |
void report_concurrent_mark_remark_times_ms(double ms); |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
114 |
void report_concurrent_mark_cleanup_times_ms(double ms); |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
115 |
void report_alloc_rate_ms(double alloc_rate); |
58508
d6058bd73982
8231153: Improve concurrent refinement statistics
kbarrett
parents:
57953
diff
changeset
|
116 |
void report_concurrent_refine_rate_ms(double cards_per_ms); |
d6058bd73982
8231153: Improve concurrent refinement statistics
kbarrett
parents:
57953
diff
changeset
|
117 |
void report_logged_cards_rate_ms(double cards_per_ms); |
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
118 |
void report_cost_per_card_scan_ms(double cost_per_remset_card_ms, bool for_young_gc); |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
119 |
void report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_gc); |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
120 |
void report_card_merge_to_scan_ratio(double cards_per_entry_ratio, bool for_young_gc); |
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
121 |
void report_rs_length_diff(double rs_length_diff); |
49643
a3453bbd5418
8199742: Clean up state flags in G1CollectorState
tschatzl
parents:
47216
diff
changeset
|
122 |
void report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress); |
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
123 |
void report_young_other_cost_per_region_ms(double other_cost_per_region_ms); |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
124 |
void report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms); |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
125 |
void report_constant_other_time_ms(double constant_other_time_ms); |
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
126 |
void report_pending_cards(double pending_cards); |
57663
bf8e76d86d05
8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents:
55510
diff
changeset
|
127 |
void report_rs_length(double rs_length); |
37051
b02a3fb98142
8150362: G1 base elapsed time prediction is wrong because rs_length prediction is wrong
sangheki
parents:
37039
diff
changeset
|
128 |
|
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
129 |
double predict_alloc_rate_ms() const; |
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
130 |
int num_alloc_rate_ms() const; |
1374 | 131 |
|
58508
d6058bd73982
8231153: Improve concurrent refinement statistics
kbarrett
parents:
57953
diff
changeset
|
132 |
double predict_concurrent_refine_rate_ms() const; |
d6058bd73982
8231153: Improve concurrent refinement statistics
kbarrett
parents:
57953
diff
changeset
|
133 |
double predict_logged_cards_rate_ms() const; |
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
134 |
double predict_young_card_merge_to_scan_ratio() const; |
1374 | 135 |
|
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
136 |
double predict_mixed_card_merge_to_scan_ratio() const; |
1374 | 137 |
|
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
138 |
size_t predict_scan_card_num(size_t rs_length, bool for_young_gc) const; |
1374 | 139 |
|
59319
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
140 |
double predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const; |
9ee940f1de90
8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents:
58798
diff
changeset
|
141 |
double predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const; |
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
142 |
|
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
143 |
double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const; |
1374 | 144 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
145 |
double predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const; |
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
146 |
|
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
147 |
double predict_constant_other_time_ms() const; |
1374 | 148 |
|
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
149 |
double predict_young_other_time_ms(size_t young_num) const; |
1374 | 150 |
|
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
151 |
double predict_non_young_other_time_ms(size_t non_young_num) const; |
1374 | 152 |
|
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
153 |
double predict_remark_time_ms() const; |
1374 | 154 |
|
33214
5a00fba36171
8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents:
33204
diff
changeset
|
155 |
double predict_cleanup_time_ms() const; |
1374 | 156 |
|
57663
bf8e76d86d05
8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents:
55510
diff
changeset
|
157 |
size_t predict_rs_length() const; |
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
158 |
size_t predict_pending_cards() const; |
1374 | 159 |
|
160 |
// Add a new GC of the given duration and end time to the record. |
|
161 |
void update_recent_gc_times(double end_time_sec, double elapsed_ms); |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
162 |
void compute_pause_time_ratio(double interval_ms, double pause_time_ms); |
1374 | 163 |
|
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37070
diff
changeset
|
164 |
double last_known_gc_end_time_sec() const; |
1374 | 165 |
}; |
166 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49643
diff
changeset
|
167 |
#endif // SHARE_GC_G1_G1ANALYTICS_HPP |