8140602: Split other time calculation into methods in G1CollectorPolicy
Reviewed-by: mgerdin, tschatzl, drwhite
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Fri Oct 30 12:36:54 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Mon Nov 02 16:16:53 2015 +0100
@@ -907,6 +907,29 @@
return phase_times()->average_time_ms(phase);
}
+double G1CollectorPolicy::young_other_time_ms() const {
+ return phase_times()->young_cset_choice_time_ms() +
+ phase_times()->young_free_cset_time_ms();
+}
+
+double G1CollectorPolicy::non_young_other_time_ms() const {
+ return phase_times()->non_young_cset_choice_time_ms() +
+ phase_times()->non_young_free_cset_time_ms();
+
+}
+
+double G1CollectorPolicy::other_time_ms(double pause_time_ms) const {
+ return pause_time_ms -
+ average_time_ms(G1GCPhaseTimes::UpdateRS) -
+ average_time_ms(G1GCPhaseTimes::ScanRS) -
+ average_time_ms(G1GCPhaseTimes::ObjCopy) -
+ average_time_ms(G1GCPhaseTimes::Termination);
+}
+
+double G1CollectorPolicy::constant_other_time_ms(double pause_time_ms) const {
+ return other_time_ms(pause_time_ms) - young_other_time_ms() - non_young_other_time_ms();
+}
+
bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) {
if (_g1->concurrent_mark()->cmThread()->during_cycle()) {
return false;
@@ -1136,37 +1159,17 @@
}
}
- double all_other_time_ms = pause_time_ms -
- (average_time_ms(G1GCPhaseTimes::UpdateRS) + average_time_ms(G1GCPhaseTimes::ScanRS) +
- average_time_ms(G1GCPhaseTimes::ObjCopy) + average_time_ms(G1GCPhaseTimes::Termination));
-
- double young_other_time_ms = 0.0;
if (young_cset_region_length() > 0) {
- young_other_time_ms =
- phase_times()->young_cset_choice_time_ms() +
- phase_times()->young_free_cset_time_ms();
- _young_other_cost_per_region_ms_seq->add(young_other_time_ms /
- (double) young_cset_region_length());
- }
- double non_young_other_time_ms = 0.0;
- if (old_cset_region_length() > 0) {
- non_young_other_time_ms =
- phase_times()->non_young_cset_choice_time_ms() +
- phase_times()->non_young_free_cset_time_ms();
-
- _non_young_other_cost_per_region_ms_seq->add(non_young_other_time_ms /
- (double) old_cset_region_length());
+ _young_other_cost_per_region_ms_seq->add(young_other_time_ms() /
+ young_cset_region_length());
}
- double constant_other_time_ms = all_other_time_ms -
- (young_other_time_ms + non_young_other_time_ms);
- _constant_other_time_ms_seq->add(constant_other_time_ms);
+ if (old_cset_region_length() > 0) {
+ _non_young_other_cost_per_region_ms_seq->add(non_young_other_time_ms() /
+ old_cset_region_length());
+ }
- double survival_ratio = 0.0;
- if (_collection_set_bytes_used_before > 0) {
- survival_ratio = (double) _bytes_copied_during_gc /
- (double) _collection_set_bytes_used_before;
- }
+ _constant_other_time_ms_seq->add(constant_other_time_ms(pause_time_ms));
_pending_cards_seq->add((double) _pending_cards);
_rs_lengths_seq->add((double) _max_rs_lengths);
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Fri Oct 30 12:36:54 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Mon Nov 02 16:16:53 2015 +0100
@@ -380,6 +380,11 @@
protected:
virtual double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const;
+ virtual double other_time_ms(double pause_time_ms) const;
+
+ double young_other_time_ms() const;
+ double non_young_other_time_ms() const;
+ double constant_other_time_ms(double pause_time_ms) const;
private:
// Statistics kept per GC stoppage, pause or full.