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/g1/concurrentG1Refine.hpp"
27 #include "gc/g1/concurrentMarkThread.inline.hpp"
28 #include "gc/g1/g1Analytics.hpp"
29 #include "gc/g1/g1CollectedHeap.inline.hpp"
30 #include "gc/g1/g1CollectionSet.hpp"
31 #include "gc/g1/g1ConcurrentMark.hpp"
32 #include "gc/g1/g1DefaultPolicy.hpp"
33 #include "gc/g1/g1HotCardCache.hpp"
34 #include "gc/g1/g1IHOPControl.hpp"
35 #include "gc/g1/g1GCPhaseTimes.hpp"
36 #include "gc/g1/g1Policy.hpp"
37 #include "gc/g1/g1SurvivorRegions.hpp"
38 #include "gc/g1/g1YoungGenSizer.hpp"
39 #include "gc/g1/heapRegion.inline.hpp"
40 #include "gc/g1/heapRegionRemSet.hpp"
41 #include "gc/shared/gcPolicyCounters.hpp"
42 #include "logging/logStream.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/java.hpp"
45 #include "runtime/mutexLocker.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/growableArray.hpp"
48 #include "utilities/pair.hpp"
49
50 G1DefaultPolicy::G1DefaultPolicy(STWGCTimer* gc_timer) :
51 _predictor(G1ConfidencePercent / 100.0),
728
729 update_ihop_prediction(app_time_ms / 1000.0,
730 _bytes_allocated_in_old_since_last_gc,
731 last_unrestrained_young_length * HeapRegion::GrainBytes);
732 _bytes_allocated_in_old_since_last_gc = 0;
733
734 _ihop_control->send_trace_event(_g1->gc_tracer_stw());
735
736 // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
737 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
738
739 if (update_rs_time_goal_ms < scan_hcc_time_ms) {
740 log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)."
741 "Update RS time goal: %1.2fms Scan HCC time: %1.2fms",
742 update_rs_time_goal_ms, scan_hcc_time_ms);
743
744 update_rs_time_goal_ms = 0;
745 } else {
746 update_rs_time_goal_ms -= scan_hcc_time_ms;
747 }
748 _g1->concurrent_g1_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms,
749 phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS),
750 update_rs_time_goal_ms);
751
752 cset_chooser()->verify();
753 }
754
755 G1IHOPControl* G1DefaultPolicy::create_ihop_control(const G1Predictions* predictor){
756 if (G1UseAdaptiveIHOP) {
757 return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
758 predictor,
759 G1ReservePercent,
760 G1HeapWastePercent);
761 } else {
762 return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
763 }
764 }
765
766 void G1DefaultPolicy::update_ihop_prediction(double mutator_time_s,
767 size_t mutator_alloc_bytes,
768 size_t young_gen_size) {
|
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/g1/concurrentMarkThread.inline.hpp"
27 #include "gc/g1/g1Analytics.hpp"
28 #include "gc/g1/g1CollectedHeap.inline.hpp"
29 #include "gc/g1/g1CollectionSet.hpp"
30 #include "gc/g1/g1ConcurrentMark.hpp"
31 #include "gc/g1/g1ConcurrentRefine.hpp"
32 #include "gc/g1/g1DefaultPolicy.hpp"
33 #include "gc/g1/g1HotCardCache.hpp"
34 #include "gc/g1/g1IHOPControl.hpp"
35 #include "gc/g1/g1GCPhaseTimes.hpp"
36 #include "gc/g1/g1Policy.hpp"
37 #include "gc/g1/g1SurvivorRegions.hpp"
38 #include "gc/g1/g1YoungGenSizer.hpp"
39 #include "gc/g1/heapRegion.inline.hpp"
40 #include "gc/g1/heapRegionRemSet.hpp"
41 #include "gc/shared/gcPolicyCounters.hpp"
42 #include "logging/logStream.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/java.hpp"
45 #include "runtime/mutexLocker.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/growableArray.hpp"
48 #include "utilities/pair.hpp"
49
50 G1DefaultPolicy::G1DefaultPolicy(STWGCTimer* gc_timer) :
51 _predictor(G1ConfidencePercent / 100.0),
728
729 update_ihop_prediction(app_time_ms / 1000.0,
730 _bytes_allocated_in_old_since_last_gc,
731 last_unrestrained_young_length * HeapRegion::GrainBytes);
732 _bytes_allocated_in_old_since_last_gc = 0;
733
734 _ihop_control->send_trace_event(_g1->gc_tracer_stw());
735
736 // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
737 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
738
739 if (update_rs_time_goal_ms < scan_hcc_time_ms) {
740 log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)."
741 "Update RS time goal: %1.2fms Scan HCC time: %1.2fms",
742 update_rs_time_goal_ms, scan_hcc_time_ms);
743
744 update_rs_time_goal_ms = 0;
745 } else {
746 update_rs_time_goal_ms -= scan_hcc_time_ms;
747 }
748 _g1->concurrent_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms,
749 phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS),
750 update_rs_time_goal_ms);
751
752 cset_chooser()->verify();
753 }
754
755 G1IHOPControl* G1DefaultPolicy::create_ihop_control(const G1Predictions* predictor){
756 if (G1UseAdaptiveIHOP) {
757 return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
758 predictor,
759 G1ReservePercent,
760 G1HeapWastePercent);
761 } else {
762 return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
763 }
764 }
765
766 void G1DefaultPolicy::update_ihop_prediction(double mutator_time_s,
767 size_t mutator_alloc_bytes,
768 size_t young_gen_size) {
|