< prev index next >

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

Print this page
rev 9402 : dihop-changes
rev 9403 : imported patch sihop-thomas-review
rev 9404 : [mq]: erik-jmasa-review


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1ErgoVerbose.hpp"
  28 #include "gc/g1/g1IHOPControl.hpp"
  29 #include "gc/g1/g1Predictions.hpp"
  30 
  31 G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
  32   _ihop_percent(initial_ihop_percent),
  33   _target_occupancy(target_occupancy) {
  34   assert(_ihop_percent >= 0.0 && _ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
  35 }
  36 
  37 G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
  38   G1IHOPControl(ihop_percent, target_occupancy),
  39   _last_allocation_time_s(0.0),
  40   _last_allocated_bytes(0),
  41   _last_marking_length_s(0.0) {
  42   assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
  43 }
  44 
  45 void G1StaticIHOPControl::print() {
  46   ergo_verbose6(ErgoIHOP,
  47                 "basic information",
  48                 ergo_format_reason("value update")
  49                 ergo_format_byte_perc("threshold")
  50                 ergo_format_byte("target occupancy")
  51                 ergo_format_byte("current occupancy")
  52                 ergo_format_double("recent old gen allocation rate")
  53                 ergo_format_ms("recent marking phase length"),
  54                 get_conc_mark_start_threshold(),
  55                 (double) get_conc_mark_start_threshold() / _target_occupancy * 100.0,
  56                 _target_occupancy,
  57                 G1CollectedHeap::heap()->used(),
  58                 _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
  59                 _last_marking_length_s * 1000.0);
  60 }
  61 
  62 #ifndef PRODUCT
  63 static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
  64   for (int i = 0; i < 100; i++) {
  65     ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
  66     ctrl->update_time_to_mixed(mark_time);
  67   }
  68 }
  69 
  70 void G1StaticIHOPControl::test() {
  71   size_t const initial_ihop = 45;
  72 
  73   G1StaticIHOPControl ctrl(initial_ihop, 100);
  74   size_t threshold;
  75   
  76   threshold = ctrl.get_conc_mark_start_threshold();
  77   assert(threshold == initial_ihop,
  78          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  79 
  80   ctrl.update_allocation_info(100.0, 100, 100);
  81   threshold = ctrl.get_conc_mark_start_threshold();
  82   assert(threshold == initial_ihop,
  83          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  84 
  85   ctrl.update_time_to_mixed(1000.0);
  86   threshold = ctrl.get_conc_mark_start_threshold();
  87   assert(threshold == initial_ihop,
  88          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  89 
  90   // Whatever we pass, the IHOP value must stay the same.
  91   test_update(&ctrl, 2, 10, 10, 3);
  92   threshold = ctrl.get_conc_mark_start_threshold();
  93   assert(threshold == initial_ihop,
  94          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  95 
  96   test_update(&ctrl, 12, 10, 10, 3);
  97   threshold = ctrl.get_conc_mark_start_threshold();
  98   assert(threshold == initial_ihop,
  99          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
 100 }
 101 #endif
 102 
 103 #ifndef PRODUCT
 104 void IHOP_test() {
 105   G1StaticIHOPControl::test();


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1ErgoVerbose.hpp"
  28 #include "gc/g1/g1IHOPControl.hpp"

  29 
  30 G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
  31   _initial_ihop_percent(initial_ihop_percent),
  32   _target_occupancy(target_occupancy) {
  33   assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
  34 }
  35 
  36 G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
  37   G1IHOPControl(ihop_percent, target_occupancy),
  38   _last_allocation_time_s(0.0),
  39   _last_allocated_bytes(0),
  40   _last_marking_length_s(0.0) {
  41   assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
  42 }
  43 
  44 void G1StaticIHOPControl::print() {
  45   ergo_verbose6(ErgoIHOP,
  46                 "basic information",
  47                 ergo_format_reason("value update")
  48                 ergo_format_byte_perc("threshold")
  49                 ergo_format_byte("target occupancy")
  50                 ergo_format_byte("current occupancy")
  51                 ergo_format_double("recent old gen allocation rate")
  52                 ergo_format_ms("recent marking phase length"),
  53                 get_conc_mark_start_threshold(),
  54                 _initial_ihop_percent,
  55                 _target_occupancy,
  56                 G1CollectedHeap::heap()->used(),
  57                 _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
  58                 _last_marking_length_s * 1000.0);
  59 }
  60 
  61 #ifndef PRODUCT
  62 static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
  63   for (int i = 0; i < 100; i++) {
  64     ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
  65     ctrl->update_marking_length(mark_time);
  66   }
  67 }
  68 
  69 void G1StaticIHOPControl::test() {
  70   size_t const initial_ihop = 45;
  71 
  72   G1StaticIHOPControl ctrl(initial_ihop, 100);
  73   size_t threshold;
  74   
  75   threshold = ctrl.get_conc_mark_start_threshold();
  76   assert(threshold == initial_ihop,
  77          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  78 
  79   ctrl.update_allocation_info(100.0, 100, 100);
  80   threshold = ctrl.get_conc_mark_start_threshold();
  81   assert(threshold == initial_ihop,
  82          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  83 
  84   ctrl.update_marking_length(1000.0);
  85   threshold = ctrl.get_conc_mark_start_threshold();
  86   assert(threshold == initial_ihop,
  87          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  88 
  89   // Whatever we pass, the IHOP value must stay the same.
  90   test_update(&ctrl, 2, 10, 10, 3);
  91   threshold = ctrl.get_conc_mark_start_threshold();
  92   assert(threshold == initial_ihop,
  93          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  94 
  95   test_update(&ctrl, 12, 10, 10, 3);
  96   threshold = ctrl.get_conc_mark_start_threshold();
  97   assert(threshold == initial_ihop,
  98          "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
  99 }
 100 #endif
 101 
 102 #ifndef PRODUCT
 103 void IHOP_test() {
 104   G1StaticIHOPControl::test();
< prev index next >