< prev index next >

src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp

Print this page
rev 8910 : full patch for jfr

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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.

@@ -280,10 +280,13 @@
   }
 
   double max_gc_time = (double) MaxGCPauseMillis / 1000.0;
   double time_slice  = (double) GCPauseIntervalMillis / 1000.0;
   _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time);
+  if (EnableJFR) {
+    _ihop_control = create_ihop_control();
+  }
 
   uintx confidence_perc = G1ConfidencePercent;
   // Put an artificial ceiling on this so that it's not set to a silly value.
   if (confidence_perc > 100) {
     confidence_perc = 100;

@@ -318,10 +321,17 @@
   _reserve_regions = 0;
 
   _collectionSetChooser = new CollectionSetChooser();
 }
 
+G1CollectorPolicy::~G1CollectorPolicy() {
+  if (EnableJFR) {
+    assert(_ihop_control != NULL, "sanity check");
+    delete _ihop_control;
+  }
+}
+
 void G1CollectorPolicy::initialize_alignments() {
   _space_alignment = HeapRegion::GrainBytes;
   size_t card_table_alignment = GenRemSet::max_alignment_constraint(GenRemSet::CardTable);
   size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
   _heap_alignment = MAX3(card_table_alignment, _space_alignment, page_size);

@@ -505,10 +515,14 @@
   // We use ceiling so that if reserve_regions_d is > 0.0 (but
   // smaller than 1.0) we'll get 1.
   _reserve_regions = (uint) ceil(reserve_regions_d);
 
   _young_gen_sizer->heap_size_changed(new_number_of_regions);
+
+  if (EnableJFR) {
+    _ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes);
+  }
 }
 
 uint G1CollectorPolicy::calculate_young_list_desired_min_length(
                                                        uint base_min_length) {
   uint desired_min_length = 0;

@@ -1187,10 +1201,19 @@
   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
   adjust_concurrent_refinement(phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS),
                                phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS), update_rs_time_goal_ms);
 
   _collectionSetChooser->verify();
+
+  if (EnableJFR) {
+    _ihop_control->send_trace_event(_g1->gc_tracer_stw());
+  }
+}
+
+G1IHOPControl* G1CollectorPolicy::create_ihop_control() {
+  assert(EnableJFR, "sanity check");
+  return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
 }
 
 #define EXT_SIZE_FORMAT "%.1f%s"
 #define EXT_SIZE_PARAMS(bytes)                                  \
   byte_size_in_proper_unit((double)(bytes)),                    \
< prev index next >