< prev index next >
src/hotspot/share/gc/g1/g1IHOPControl.cpp
Print this page
rev 60584 : imported patch 8245511-ihop
rev 60585 : [mq]: 8245511-rev1
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -27,30 +27,30 @@
#include "gc/g1/g1IHOPControl.hpp"
#include "gc/g1/g1Predictions.hpp"
#include "gc/g1/g1Trace.hpp"
#include "logging/log.hpp"
-G1IHOPControl::G1IHOPControl(double initial_ihop_percent) :
+G1IHOPControl::G1IHOPControl(double initial_ihop_percent,
+ G1OldGenAllocationTracker const* old_gen_alloc_tracker) :
_initial_ihop_percent(initial_ihop_percent),
_target_occupancy(0),
_last_allocation_time_s(0.0),
- _last_allocated_bytes(0)
+ _old_gen_alloc_tracker(old_gen_alloc_tracker)
{
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);
}
void G1IHOPControl::update_target_occupancy(size_t new_target_occupancy) {
log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B",
_target_occupancy, new_target_occupancy);
_target_occupancy = new_target_occupancy;
}
-void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
+void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t additional_buffer_size) {
assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
_last_allocation_time_s = allocation_time_s;
- _last_allocated_bytes = allocated_bytes;
}
void G1IHOPControl::print() {
assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
@@ -58,36 +58,38 @@
"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",
cur_conc_mark_start_threshold,
percent_of(cur_conc_mark_start_threshold, _target_occupancy),
_target_occupancy,
G1CollectedHeap::heap()->used(),
- _last_allocated_bytes,
+ _old_gen_alloc_tracker->last_period_old_gen_bytes(),
_last_allocation_time_s * 1000.0,
- _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
+ _last_allocation_time_s > 0.0 ? _old_gen_alloc_tracker->last_period_old_gen_bytes() / _last_allocation_time_s : 0.0,
last_marking_length_s() * 1000.0);
}
void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
_target_occupancy,
G1CollectedHeap::heap()->used(),
- _last_allocated_bytes,
+ _old_gen_alloc_tracker->last_period_old_gen_bytes(),
_last_allocation_time_s,
last_marking_length_s());
}
-G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent) :
- G1IHOPControl(ihop_percent),
+G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent,
+ G1OldGenAllocationTracker const* old_gen_alloc_tracker) :
+ G1IHOPControl(ihop_percent, old_gen_alloc_tracker),
_last_marking_length_s(0.0) {
}
G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
+ G1OldGenAllocationTracker const* old_gen_alloc_tracker,
G1Predictions const* predictor,
size_t heap_reserve_percent,
size_t heap_waste_percent) :
- G1IHOPControl(ihop_percent),
+ G1IHOPControl(ihop_percent, old_gen_alloc_tracker),
_heap_reserve_percent(heap_reserve_percent),
_heap_waste_percent(heap_waste_percent),
_predictor(predictor),
_marking_times_s(10, 0.95),
_allocation_rate_s(10, 0.95),
@@ -143,17 +145,20 @@
// Use the initial value.
return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0);
}
}
+double G1AdaptiveIHOPControl::last_mutator_period_old_allocation_rate() const {
+ assert(_last_allocation_time_s > 0, "This should not be called when the last GC is full");
+
+ return _old_gen_alloc_tracker->last_period_old_gen_growth() / _last_allocation_time_s;
+ }
+
void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s,
- size_t allocated_bytes,
size_t additional_buffer_size) {
- G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size);
-
- double allocation_rate = (double) allocated_bytes / allocation_time_s;
- _allocation_rate_s.add(allocation_rate);
+ G1IHOPControl::update_allocation_info(allocation_time_s, additional_buffer_size);
+ _allocation_rate_s.add(last_mutator_period_old_allocation_rate());
_last_unrestrained_young_size = additional_buffer_size;
}
void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) {
< prev index next >