< prev index next >
src/share/vm/gc/g1/g1CollectorPolicy.hpp
Print this page
rev 9431 : dihop-changes
rev 9433 : imported patch erik-jmasa-review
rev 9434 : imported patch fix-evac-failure-needs-stats
rev 9435 : [mq]: mikael-erik-review
@@ -27,21 +27,24 @@
#include "gc/g1/collectionSetChooser.hpp"
#include "gc/g1/g1CollectorState.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp"
#include "gc/g1/g1InCSetState.hpp"
+#include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp"
#include "gc/g1/g1MMUTracker.hpp"
#include "gc/g1/g1Predictions.hpp"
#include "gc/shared/collectorPolicy.hpp"
+#include "utilities/pair.hpp"
// A G1CollectorPolicy makes policy decisions that determine the
// characteristics of the collector. Examples include:
// * choice of collection set.
// * when to collect.
class HeapRegion;
class CollectionSetChooser;
+class G1IHOPControl;
// TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses
// (the latter may contain non-young regions - i.e. regions that are
// technically in old) while TraceOldGenTime collects data about full GCs.
class TraceYoungGenTimeData : public CHeapObj<mtGC> {
@@ -161,10 +164,19 @@
}
};
class G1CollectorPolicy: public CollectorPolicy {
private:
+ G1IHOPControl* _ihop_control;
+
+ G1IHOPControl* create_ihop_control() const;
+ // Update the IHOP control with necessary statistics.
+ void update_ihop_prediction(double mutator_time_s,
+ size_t mutator_alloc_bytes,
+ size_t young_gen_size);
+ void report_ihop_statistics();
+
G1Predictions _predictor;
double get_new_prediction(TruncatedSeq const* seq) const;
// either equal to the number of parallel threads, if ParallelGCThreads
@@ -269,13 +281,21 @@
double _pause_time_target_ms;
size_t _pending_cards;
+ // The amount of allocated bytes in old gen during the last mutator and the following
+ // young GC phase.
+ size_t _bytes_allocated_in_old_since_last_gc;
+
+ G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed;
public:
const G1Predictions& predictor() const { return _predictor; }
+ // Add the given number of bytes to the total number of allocated bytes in the old gen.
+ void add_bytes_allocated_in_old_since_last_gc(size_t bytes) { _bytes_allocated_in_old_since_last_gc += bytes; }
+
// Accessors
void set_region_eden(HeapRegion* hr, int young_index_in_cset) {
hr->set_eden();
hr->install_surv_rate_group(_short_lived_surv_rate_group);
@@ -471,20 +491,22 @@
// determine whether we should initiate a new marking.
double _cur_mark_stop_world_time_ms;
double _mark_remark_start_sec;
double _mark_cleanup_start_sec;
- void update_young_list_max_and_target_length();
- void update_young_list_max_and_target_length(size_t rs_lengths);
+ // Updates the internal young list maximum and target lengths. Returns the
+ // unbounded young list target length.
+ uint update_young_list_max_and_target_length();
+ uint update_young_list_max_and_target_length(size_t rs_lengths);
// Update the young list target length either by setting it to the
// desired fixed value or by calculating it using G1's pause
// prediction model. If no rs_lengths parameter is passed, predict
// the RS lengths using the prediction model, otherwise use the
// given rs_lengths as the prediction.
- void update_young_list_target_length();
- void update_young_list_target_length(size_t rs_lengths);
+ // Returns the unbounded young list target length.
+ uint update_young_list_target_length(size_t rs_lengths);
// Calculate and return the minimum desired young list target
// length. This is the minimum desired young list length according
// to the user's inputs.
uint calculate_young_list_desired_min_length(uint base_min_length) const;
@@ -503,11 +525,14 @@
uint calculate_young_list_target_length(size_t rs_lengths,
uint base_min_length,
uint desired_min_length,
uint desired_max_length) const;
- uint bounded_young_list_target_length(size_t rs_lengths) const;
+ // Result of the bounded_young_list_target_length() method, containing both the
+ // bounded as well as the unbounded young list target lengths in this order.
+ typedef Pair<uint, uint, StackObj> YoungTargetLengths;
+ YoungTargetLengths young_list_target_lengths(size_t rs_lengths) const;
void update_rs_lengths_prediction();
void update_rs_lengths_prediction(size_t prediction);
// Calculate and return chunk size (in number of regions) for parallel
@@ -534,14 +559,34 @@
// as a percentage of the current heap capacity.
double reclaimable_bytes_perc(size_t reclaimable_bytes) const;
// Sets up marking if proper conditions are met.
void maybe_start_marking();
+
+ // The kind of STW pause.
+ enum PauseKind {
+ FullGC,
+ YoungOnlyGC,
+ MixedGC,
+ LastYoungGC,
+ InitialMarkGC,
+ Cleanup,
+ Remark
+ };
+
+ // Calculate PauseKind from internal state.
+ PauseKind young_gc_pause_kind() const;
+ // Record the given STW pause with the given start and end times (in s).
+ void record_pause(PauseKind kind, double start, double end);
+ // Indicate that we aborted marking before doing any mixed GCs.
+ void abort_time_to_mixed_tracking();
public:
G1CollectorPolicy();
+ virtual ~G1CollectorPolicy();
+
virtual G1CollectorPolicy* as_g1_policy() { return this; }
G1CollectorState* collector_state() const;
G1GCPhaseTimes* phase_times() const { return _phase_times; }
< prev index next >