author | tschatzl |
Wed, 18 Apr 2018 11:36:48 +0200 | |
changeset 49806 | 2d62570a615c |
parent 47679 | 4cfcb7be4984 |
child 51332 | c25572739e7c |
permissions | -rw-r--r-- |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
1 |
/* |
47679
4cfcb7be4984
8189666: Replace various inlined percentage calculations with global percent_of()
tschatzl
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
4 |
* |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
8 |
* |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
14 |
* |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
18 |
* |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
22 |
* |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
23 |
*/ |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
24 |
|
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
26 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
27 |
#include "gc/g1/g1IHOPControl.hpp" |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
28 |
#include "gc/g1/g1Predictions.hpp" |
34300 | 29 |
#include "gc/shared/gcTrace.hpp" |
35061 | 30 |
#include "logging/log.hpp" |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
31 |
|
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
32 |
G1IHOPControl::G1IHOPControl(double initial_ihop_percent) : |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
33 |
_initial_ihop_percent(initial_ihop_percent), |
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
34 |
_target_occupancy(0), |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
35 |
_last_allocated_bytes(0), |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
36 |
_last_allocation_time_s(0.0) |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
37 |
{ |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
38 |
assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent); |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
39 |
} |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
40 |
|
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
41 |
void G1IHOPControl::update_target_occupancy(size_t new_target_occupancy) { |
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
42 |
log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B", |
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
43 |
_target_occupancy, new_target_occupancy); |
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
44 |
_target_occupancy = new_target_occupancy; |
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
45 |
} |
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
46 |
|
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
47 |
void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) { |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
48 |
assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s); |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
49 |
|
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
50 |
_last_allocation_time_s = allocation_time_s; |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
51 |
_last_allocated_bytes = allocated_bytes; |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
52 |
} |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
53 |
|
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
54 |
void G1IHOPControl::print() { |
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
55 |
assert(_target_occupancy > 0, "Target occupancy still not updated yet."); |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
56 |
size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold(); |
36366
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
57 |
log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, " |
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
58 |
"recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms", |
35061 | 59 |
cur_conc_mark_start_threshold, |
47679
4cfcb7be4984
8189666: Replace various inlined percentage calculations with global percent_of()
tschatzl
parents:
47216
diff
changeset
|
60 |
percent_of(cur_conc_mark_start_threshold, _target_occupancy), |
35061 | 61 |
_target_occupancy, |
62 |
G1CollectedHeap::heap()->used(), |
|
36366
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
63 |
_last_allocated_bytes, |
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
64 |
_last_allocation_time_s * 1000.0, |
35061 | 65 |
_last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0, |
36366
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
66 |
last_marking_length_s() * 1000.0); |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
67 |
} |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
68 |
|
34300 | 69 |
void G1IHOPControl::send_trace_event(G1NewTracer* tracer) { |
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
70 |
assert(_target_occupancy > 0, "Target occupancy still not updated yet."); |
34300 | 71 |
tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(), |
72 |
_target_occupancy, |
|
73 |
G1CollectedHeap::heap()->used(), |
|
74 |
_last_allocated_bytes, |
|
75 |
_last_allocation_time_s, |
|
76 |
last_marking_length_s()); |
|
77 |
} |
|
78 |
||
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
79 |
G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent) : |
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
80 |
G1IHOPControl(ihop_percent), |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
81 |
_last_marking_length_s(0.0) { |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
82 |
} |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff
changeset
|
83 |
|
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
84 |
G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent, |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
85 |
G1Predictions const* predictor, |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
86 |
size_t heap_reserve_percent, |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
87 |
size_t heap_waste_percent) : |
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
88 |
G1IHOPControl(ihop_percent), |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
89 |
_predictor(predictor), |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
90 |
_marking_times_s(10, 0.95), |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
91 |
_allocation_rate_s(10, 0.95), |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
92 |
_last_unrestrained_young_size(0), |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
93 |
_heap_reserve_percent(heap_reserve_percent), |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
94 |
_heap_waste_percent(heap_waste_percent) |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
95 |
{ |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
96 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
97 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
98 |
size_t G1AdaptiveIHOPControl::actual_target_threshold() const { |
36577
e177c49493e9
8142484: Let IHOP follow the current capacity, not the maximum capacity
tschatzl
parents:
36366
diff
changeset
|
99 |
guarantee(_target_occupancy > 0, "Target occupancy still not updated yet."); |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
100 |
// The actual target threshold takes the heap reserve and the expected waste in |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
101 |
// free space into account. |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
102 |
// _heap_reserve is that part of the total heap capacity that is reserved for |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
103 |
// eventual promotion failure. |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
104 |
// _heap_waste is the amount of space will never be reclaimed in any |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
105 |
// heap, so can not be used for allocation during marking and must always be |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
106 |
// considered. |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
107 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
108 |
double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
109 |
|
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
110 |
return (size_t)MIN2( |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
111 |
G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0, |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
112 |
_target_occupancy * (100.0 - _heap_waste_percent) / 100.0 |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
113 |
); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
114 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
115 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
116 |
bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const { |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
117 |
return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) && |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
118 |
((size_t)_allocation_rate_s.num() >= G1AdaptiveIHOPNumInitialSamples); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
119 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
120 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
121 |
size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() { |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
122 |
if (have_enough_data_for_prediction()) { |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
123 |
double pred_marking_time = _predictor->get_new_prediction(&_marking_times_s); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
124 |
double pred_promotion_rate = _predictor->get_new_prediction(&_allocation_rate_s); |
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
125 |
size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate); |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
126 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
127 |
size_t predicted_needed_bytes_during_marking = |
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
128 |
pred_promotion_size + |
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
129 |
// In reality we would need the maximum size of the young gen during |
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
130 |
// marking. This is a conservative estimate. |
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
131 |
_last_unrestrained_young_size; |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
132 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
133 |
size_t internal_threshold = actual_target_threshold(); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
134 |
size_t predicted_initiating_threshold = predicted_needed_bytes_during_marking < internal_threshold ? |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
135 |
internal_threshold - predicted_needed_bytes_during_marking : |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
136 |
0; |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
137 |
return predicted_initiating_threshold; |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
138 |
} else { |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
139 |
// Use the initial value. |
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
140 |
return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0); |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
141 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
142 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
143 |
|
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
144 |
void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, |
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
145 |
size_t allocated_bytes, |
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
35061
diff
changeset
|
146 |
size_t additional_buffer_size) { |
34300 | 147 |
G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size); |
148 |
||
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
149 |
double allocation_rate = (double) allocated_bytes / allocation_time_s; |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
150 |
_allocation_rate_s.add(allocation_rate); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
151 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
152 |
_last_unrestrained_young_size = additional_buffer_size; |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
153 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
154 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
155 |
void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) { |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
156 |
assert(marking_length_s >= 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
157 |
_marking_times_s.add(marking_length_s); |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
158 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
159 |
|
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
160 |
void G1AdaptiveIHOPControl::print() { |
34300 | 161 |
G1IHOPControl::print(); |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
162 |
size_t actual_target = actual_target_threshold(); |
36366
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
163 |
log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: " SIZE_FORMAT "B (%1.2f), internal target occupancy: " SIZE_FORMAT "B, " |
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
164 |
"occupancy: " SIZE_FORMAT "B, additional buffer size: " SIZE_FORMAT "B, predicted old gen allocation rate: %1.2fB/s, " |
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
165 |
"predicted marking phase length: %1.2fms, prediction active: %s", |
35061 | 166 |
get_conc_mark_start_threshold(), |
167 |
percent_of(get_conc_mark_start_threshold(), actual_target), |
|
168 |
actual_target, |
|
36366
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
169 |
G1CollectedHeap::heap()->used(), |
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
170 |
_last_unrestrained_young_size, |
35061 | 171 |
_predictor->get_new_prediction(&_allocation_rate_s), |
36366
664ae1e77870
8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents:
35196
diff
changeset
|
172 |
_predictor->get_new_prediction(&_marking_times_s) * 1000.0, |
35061 | 173 |
have_enough_data_for_prediction() ? "true" : "false"); |
34299
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
174 |
} |
3fdfdda0ac1f
8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents:
34298
diff
changeset
|
175 |
|
34300 | 176 |
void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) { |
177 |
G1IHOPControl::send_trace_event(tracer); |
|
178 |
tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(), |
|
179 |
actual_target_threshold(), |
|
180 |
G1CollectedHeap::heap()->used(), |
|
181 |
_last_unrestrained_young_size, |
|
182 |
_predictor->get_new_prediction(&_allocation_rate_s), |
|
183 |
_predictor->get_new_prediction(&_marking_times_s), |
|
184 |
have_enough_data_for_prediction()); |
|
185 |
} |