< prev index next >

src/share/vm/gc/g1/g1IHOPControl.cpp

Print this page
rev 9431 : dihop-changes
rev 9432 : imported patch sihop-thomas-review
rev 9433 : imported patch erik-jmasa-review
rev 9434 : imported patch fix-evac-failure-needs-stats
rev 9435 : [mq]: mikael-erik-review


  62 }
  63 
  64 G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
  65   G1IHOPControl(ihop_percent, target_occupancy),
  66   _last_marking_length_s(0.0) {
  67   assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
  68 }
  69 
  70 #ifndef PRODUCT
  71 static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
  72   for (int i = 0; i < 100; i++) {
  73     ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
  74     ctrl->update_marking_length(mark_time);
  75   }
  76 }
  77 
  78 void G1StaticIHOPControl::test() {
  79   size_t const initial_ihop = 45;
  80 
  81   G1StaticIHOPControl ctrl(initial_ihop, 100);
  82   size_t threshold;
  83   
  84   threshold = ctrl.get_conc_mark_start_threshold();
  85   assert(threshold == initial_ihop,
  86          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  87 
  88   ctrl.update_allocation_info(100.0, 100, 100);
  89   threshold = ctrl.get_conc_mark_start_threshold();
  90   assert(threshold == initial_ihop,
  91          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  92 
  93   ctrl.update_marking_length(1000.0);
  94   threshold = ctrl.get_conc_mark_start_threshold();
  95   assert(threshold == initial_ihop,
  96          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  97 
  98   // Whatever we pass, the IHOP value must stay the same.
  99   test_update(&ctrl, 2, 10, 10, 3);
 100   threshold = ctrl.get_conc_mark_start_threshold();
 101   assert(threshold == initial_ihop,
 102          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
 103 
 104   test_update(&ctrl, 12, 10, 10, 3);
 105   threshold = ctrl.get_conc_mark_start_threshold();
 106   assert(threshold == initial_ihop,
 107          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
 108 }
 109 #endif
 110 
 111 #ifndef PRODUCT
 112 void IHOP_test() {
 113   G1StaticIHOPControl::test();
 114 }
 115 #endif


  62 }
  63 
  64 G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
  65   G1IHOPControl(ihop_percent, target_occupancy),
  66   _last_marking_length_s(0.0) {
  67   assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
  68 }
  69 
  70 #ifndef PRODUCT
  71 static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
  72   for (int i = 0; i < 100; i++) {
  73     ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
  74     ctrl->update_marking_length(mark_time);
  75   }
  76 }
  77 
  78 void G1StaticIHOPControl::test() {
  79   size_t const initial_ihop = 45;
  80 
  81   G1StaticIHOPControl ctrl(initial_ihop, 100);

  82 
  83   size_t threshold = ctrl.get_conc_mark_start_threshold();
  84   assert(threshold == initial_ihop,
  85          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  86 
  87   ctrl.update_allocation_info(100.0, 100, 100);
  88   threshold = ctrl.get_conc_mark_start_threshold();
  89   assert(threshold == initial_ihop,
  90          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  91 
  92   ctrl.update_marking_length(1000.0);
  93   threshold = ctrl.get_conc_mark_start_threshold();
  94   assert(threshold == initial_ihop,
  95          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  96 
  97   // Whatever we pass, the IHOP value must stay the same.
  98   test_update(&ctrl, 2, 10, 10, 3);
  99   threshold = ctrl.get_conc_mark_start_threshold();
 100   assert(threshold == initial_ihop,
 101          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
 102 
 103   test_update(&ctrl, 12, 10, 10, 3);
 104   threshold = ctrl.get_conc_mark_start_threshold();
 105   assert(threshold == initial_ihop,
 106          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
 107 }

 108 

 109 void IHOP_test() {
 110   G1StaticIHOPControl::test();
 111 }
 112 #endif
< prev index next >