8149013: Remove unused and dead code from G1CollectorPolicy
authormgerdin
Thu, 04 Feb 2016 08:22:26 +0100
changeset 36191 07d2ba48d1d3
parent 36187 1d61b06a3ae1
child 36192 68b97901a2bd
8149013: Remove unused and dead code from G1CollectorPolicy Reviewed-by: ehelin, jwilhelm
hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp
hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp
hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Feb 17 18:02:03 2016 -0500
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Feb 04 08:22:26 2016 +0100
@@ -2777,12 +2777,6 @@
 }
 
 void G1CollectedHeap::print_tracing_info() const {
-  // We'll overload this to mean "trace GC pause statistics."
-  if (TraceYoungGenTime || TraceOldGenTime) {
-    // The "G1CollectorPolicy" is keeping track of these stats, so delegate
-    // to that.
-    g1_policy()->print_tracing_info();
-  }
   g1_rem_set()->print_summary_info();
   concurrent_mark()->print_summary_info();
   g1_policy()->print_yg_surv_rate_info();
@@ -2908,7 +2902,6 @@
                                                bool* succeeded,
                                                GCCause::Cause gc_cause) {
   assert_heap_not_locked_and_not_at_safepoint();
-  g1_policy()->record_stop_world_start();
   VM_G1IncCollectionPause op(gc_count_before,
                              word_size,
                              false, /* should_initiate_conc_mark */
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Wed Feb 17 18:02:03 2016 -0500
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Thu Feb 04 08:22:26 2016 +0100
@@ -81,10 +81,8 @@
 
 G1CollectorPolicy::G1CollectorPolicy() :
   _predictor(G1ConfidencePercent / 100.0),
-  _parallel_gc_threads(ParallelGCThreads),
 
   _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
-  _stop_world_start(0.0),
 
   _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
   _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
@@ -129,7 +127,6 @@
   _inc_cset_head(NULL),
   _inc_cset_tail(NULL),
   _inc_cset_bytes_used_before(0),
-  _inc_cset_max_finger(NULL),
   _inc_cset_recorded_rs_lengths(0),
   _inc_cset_recorded_rs_lengths_diffs(0),
   _inc_cset_predicted_elapsed_time_ms(0.0),
@@ -172,9 +169,9 @@
   _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
   clear_ratio_check_data();
 
-  _phase_times = new G1GCPhaseTimes(_parallel_gc_threads);
+  _phase_times = new G1GCPhaseTimes(ParallelGCThreads);
 
-  int index = MIN2(_parallel_gc_threads - 1, 7);
+  int index = MIN2(ParallelGCThreads - 1, 7u);
 
   _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
   _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
@@ -872,8 +869,6 @@
   double full_gc_time_sec = end_sec - _full_collection_start_sec;
   double full_gc_time_ms = full_gc_time_sec * 1000.0;
 
-  _trace_old_gen_time_data.record_full_collection(full_gc_time_ms);
-
   update_recent_gc_times(end_sec, full_gc_time_ms);
 
   collector_state()->set_full_collection(false);
@@ -904,10 +899,6 @@
   record_pause(FullGC, _full_collection_start_sec, end_sec);
 }
 
-void G1CollectorPolicy::record_stop_world_start() {
-  _stop_world_start = os::elapsedTime();
-}
-
 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
   // We only need to do this here as the policy will only be applied
   // to the GC we're about to start. so, no point is calculating this
@@ -918,10 +909,6 @@
          "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
          _g1->used(), _g1->recalculate_used());
 
-  double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
-  _trace_young_gen_time_data.record_start_collection(s_w_t_ms);
-  _stop_world_start = 0.0;
-
   phase_times()->record_cur_collection_start_sec(start_time_sec);
   _pending_cards = _g1->pending_card_num();
 
@@ -973,13 +960,6 @@
   collector_state()->set_in_marking_window(false);
 }
 
-void G1CollectorPolicy::record_concurrent_pause() {
-  if (_stop_world_start > 0.0) {
-    double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0;
-    _trace_young_gen_time_data.record_yield_time(yield_ms);
-  }
-}
-
 double G1CollectorPolicy::average_time_ms(G1GCPhaseTimes::GCParPhases phase) const {
   return phase_times()->average_time_ms(phase);
 }
@@ -1064,7 +1044,6 @@
   }
 
   if (update_stats) {
-    _trace_young_gen_time_data.record_end_collection(pause_time_ms, phase_times());
     // We maintain the invariant that all objects allocated by mutator
     // threads will be allocated out of eden regions. So, we can use
     // the eden region number allocated since the previous GC to
@@ -1654,11 +1633,6 @@
   return expand_bytes;
 }
 
-void G1CollectorPolicy::print_tracing_info() const {
-  _trace_young_gen_time_data.print();
-  _trace_old_gen_time_data.print();
-}
-
 void G1CollectorPolicy::print_yg_surv_rate_info() const {
 #ifndef PRODUCT
   _short_lived_surv_rate_group->print_surv_rate_summary();
@@ -1869,7 +1843,6 @@
   _inc_cset_tail = NULL;
   _inc_cset_bytes_used_before = 0;
 
-  _inc_cset_max_finger = 0;
   _inc_cset_recorded_rs_lengths = 0;
   _inc_cset_recorded_rs_lengths_diffs = 0;
   _inc_cset_predicted_elapsed_time_ms = 0.0;
@@ -1981,9 +1954,6 @@
   size_t rs_length = hr->rem_set()->occupied();
   add_to_incremental_cset_info(hr, rs_length);
 
-  HeapWord* hr_end = hr->end();
-  _inc_cset_max_finger = MAX2(_inc_cset_max_finger, hr_end);
-
   assert(!hr->in_collection_set(), "invariant");
   _g1->register_young_region_with_cset(hr);
   assert(hr->next_in_collection_set() == NULL, "invariant");
@@ -2190,12 +2160,6 @@
 
   collector_state()->set_last_gc_was_young(collector_state()->gcs_are_young());
 
-  if (collector_state()->last_gc_was_young()) {
-    _trace_young_gen_time_data.increment_young_collection_count();
-  } else {
-    _trace_young_gen_time_data.increment_mixed_collection_count();
-  }
-
   // The young list is laid with the survivor regions from the previous
   // pause are appended to the RHS of the young list, i.e.
   //   [Newly Young Regions ++ Survivors from last pause].
@@ -2335,127 +2299,3 @@
   double non_young_end_time_sec = os::elapsedTime();
   phase_times()->record_non_young_cset_choice_time_ms((non_young_end_time_sec - non_young_start_time_sec) * 1000.0);
 }
-
-void TraceYoungGenTimeData::record_start_collection(double time_to_stop_the_world_ms) {
-  if(TraceYoungGenTime) {
-    _all_stop_world_times_ms.add(time_to_stop_the_world_ms);
-  }
-}
-
-void TraceYoungGenTimeData::record_yield_time(double yield_time_ms) {
-  if(TraceYoungGenTime) {
-    _all_yield_times_ms.add(yield_time_ms);
-  }
-}
-
-void TraceYoungGenTimeData::record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times) {
-  if(TraceYoungGenTime) {
-    _total.add(pause_time_ms);
-    _other.add(pause_time_ms - phase_times->accounted_time_ms());
-    _root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms());
-    _parallel.add(phase_times->cur_collection_par_time_ms());
-    _ext_root_scan.add(phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan));
-    _satb_filtering.add(phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering));
-    _update_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS));
-    _scan_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::ScanRS));
-    _obj_copy.add(phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy));
-    _termination.add(phase_times->average_time_ms(G1GCPhaseTimes::Termination));
-
-    double parallel_known_time = phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan) +
-      phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering) +
-      phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS) +
-      phase_times->average_time_ms(G1GCPhaseTimes::ScanRS) +
-      phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy) +
-      phase_times->average_time_ms(G1GCPhaseTimes::Termination);
-
-    double parallel_other_time = phase_times->cur_collection_par_time_ms() - parallel_known_time;
-    _parallel_other.add(parallel_other_time);
-    _clear_ct.add(phase_times->cur_clear_ct_time_ms());
-  }
-}
-
-void TraceYoungGenTimeData::increment_young_collection_count() {
-  if(TraceYoungGenTime) {
-    ++_young_pause_num;
-  }
-}
-
-void TraceYoungGenTimeData::increment_mixed_collection_count() {
-  if(TraceYoungGenTime) {
-    ++_mixed_pause_num;
-  }
-}
-
-void TraceYoungGenTimeData::print_summary(const char* str,
-                                          const NumberSeq* seq) const {
-  double sum = seq->sum();
-  tty->print_cr("%-27s = %8.2lf s (avg = %8.2lf ms)",
-                str, sum / 1000.0, seq->avg());
-}
-
-void TraceYoungGenTimeData::print_summary_sd(const char* str,
-                                             const NumberSeq* seq) const {
-  print_summary(str, seq);
-  tty->print_cr("%45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
-                "(num", seq->num(), seq->sd(), seq->maximum());
-}
-
-void TraceYoungGenTimeData::print() const {
-  if (!TraceYoungGenTime) {
-    return;
-  }
-
-  tty->print_cr("ALL PAUSES");
-  print_summary_sd("   Total", &_total);
-  tty->cr();
-  tty->cr();
-  tty->print_cr("   Young GC Pauses: %8d", _young_pause_num);
-  tty->print_cr("   Mixed GC Pauses: %8d", _mixed_pause_num);
-  tty->cr();
-
-  tty->print_cr("EVACUATION PAUSES");
-
-  if (_young_pause_num == 0 && _mixed_pause_num == 0) {
-    tty->print_cr("none");
-  } else {
-    print_summary_sd("   Evacuation Pauses", &_total);
-    print_summary("      Root Region Scan Wait", &_root_region_scan_wait);
-    print_summary("      Parallel Time", &_parallel);
-    print_summary("         Ext Root Scanning", &_ext_root_scan);
-    print_summary("         SATB Filtering", &_satb_filtering);
-    print_summary("         Update RS", &_update_rs);
-    print_summary("         Scan RS", &_scan_rs);
-    print_summary("         Object Copy", &_obj_copy);
-    print_summary("         Termination", &_termination);
-    print_summary("         Parallel Other", &_parallel_other);
-    print_summary("      Clear CT", &_clear_ct);
-    print_summary("      Other", &_other);
-  }
-  tty->cr();
-
-  tty->print_cr("MISC");
-  print_summary_sd("   Stop World", &_all_stop_world_times_ms);
-  print_summary_sd("   Yields", &_all_yield_times_ms);
-}
-
-void TraceOldGenTimeData::record_full_collection(double full_gc_time_ms) {
-  if (TraceOldGenTime) {
-    _all_full_gc_times.add(full_gc_time_ms);
-  }
-}
-
-void TraceOldGenTimeData::print() const {
-  if (!TraceOldGenTime) {
-    return;
-  }
-
-  if (_all_full_gc_times.num() > 0) {
-    tty->print("\n%4d full_gcs: total time = %8.2f s",
-      _all_full_gc_times.num(),
-      _all_full_gc_times.sum() / 1000.0);
-    tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times.avg());
-    tty->print_cr("                     [std. dev = %8.2f ms, max = %8.2f ms]",
-      _all_full_gc_times.sd(),
-      _all_full_gc_times.maximum());
-  }
-}
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Wed Feb 17 18:02:03 2016 -0500
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Thu Feb 04 08:22:26 2016 +0100
@@ -45,52 +45,6 @@
 class G1IHOPControl;
 class G1YoungGenSizer;
 
-// 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> {
- private:
-  unsigned  _young_pause_num;
-  unsigned  _mixed_pause_num;
-
-  NumberSeq _all_stop_world_times_ms;
-  NumberSeq _all_yield_times_ms;
-
-  NumberSeq _total;
-  NumberSeq _other;
-  NumberSeq _root_region_scan_wait;
-  NumberSeq _parallel;
-  NumberSeq _ext_root_scan;
-  NumberSeq _satb_filtering;
-  NumberSeq _update_rs;
-  NumberSeq _scan_rs;
-  NumberSeq _obj_copy;
-  NumberSeq _termination;
-  NumberSeq _parallel_other;
-  NumberSeq _clear_ct;
-
-  void print_summary(const char* str, const NumberSeq* seq) const;
-  void print_summary_sd(const char* str, const NumberSeq* seq) const;
-
-public:
-   TraceYoungGenTimeData() : _young_pause_num(0), _mixed_pause_num(0) {};
-  void record_start_collection(double time_to_stop_the_world_ms);
-  void record_yield_time(double yield_time_ms);
-  void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times);
-  void increment_young_collection_count();
-  void increment_mixed_collection_count();
-  void print() const;
-};
-
-class TraceOldGenTimeData : public CHeapObj<mtGC> {
- private:
-  NumberSeq _all_full_gc_times;
-
- public:
-  void record_full_collection(double full_gc_time_ms);
-  void print() const;
-};
-
 class G1CollectorPolicy: public CollectorPolicy {
  private:
   G1IHOPControl* _ihop_control;
@@ -107,13 +61,6 @@
   double get_new_prediction(TruncatedSeq const* seq) const;
   size_t get_new_size_prediction(TruncatedSeq const* seq) const;
 
-  // either equal to the number of parallel threads, if ParallelGCThreads
-  // has been set, or 1 otherwise
-  int _parallel_gc_threads;
-
-  // The number of GC threads currently active.
-  uintx _no_of_gc_threads;
-
   G1MMUTracker* _mmu_tracker;
 
   void initialize_alignments();
@@ -134,11 +81,6 @@
   double _ratio_over_threshold_sum;
   uint _pauses_since_start;
 
-  TraceYoungGenTimeData _trace_young_gen_time_data;
-  TraceOldGenTimeData   _trace_old_gen_time_data;
-
-  double _stop_world_start;
-
   uint _young_list_target_length;
   uint _young_list_fixed_length;
 
@@ -212,9 +154,6 @@
                                     double update_rs_processed_buffers,
                                     double goal_ms);
 
-  uintx no_of_gc_threads() { return _no_of_gc_threads; }
-  void set_no_of_gc_threads(uintx v) { _no_of_gc_threads = v; }
-
   double _pause_time_target_ms;
 
   size_t _pending_cards;
@@ -389,9 +328,6 @@
   // an evacuation pause.
   size_t _inc_cset_bytes_used_before;
 
-  // Used to record the highest end of heap region in collection set
-  HeapWord* _inc_cset_max_finger;
-
   // The RSet lengths recorded for regions in the CSet. It is updated
   // by the thread that adds a new region to the CSet. We assume that
   // only one thread can be allocating a new CSet region (currently,
@@ -573,9 +509,6 @@
 
   virtual void print_phases();
 
-  void record_stop_world_start();
-  void record_concurrent_pause();
-
   // Record how much space we copied during a GC. This is typically
   // called when a GC alloc region is being retired.
   void record_bytes_copied_during_gc(size_t bytes) {
@@ -685,9 +618,6 @@
   // Clear ratio tracking data used by expansion_amount().
   void clear_ratio_check_data();
 
-  // Print tracing information.
-  void print_tracing_info() const;
-
   // Print stats on young survival ratio
   void print_yg_surv_rate_info() const;
 
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Wed Feb 17 18:02:03 2016 -0500
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Thu Feb 04 08:22:26 2016 +0100
@@ -2662,9 +2662,6 @@
 // We take a break if someone is trying to stop the world.
 bool G1ConcurrentMark::do_yield_check(uint worker_id) {
   if (SuspendibleThreadSet::should_yield()) {
-    if (worker_id == 0) {
-      _g1h->g1_policy()->record_concurrent_pause();
-    }
     SuspendibleThreadSet::yield();
     return true;
   } else {