hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp
author tschatzl
Fri, 26 Feb 2016 13:02:30 +0100
changeset 36366 664ae1e77870
parent 35196 c83940b346b2
child 36577 e177c49493e9
permissions -rw-r--r--
8140777: Make Adaptive IHOP logging information the same as JFR logging Reviewed-by: tbenson, jmasa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     1
/*
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     4
 *
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     8
 *
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    14
 *
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    18
 *
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    21
 * questions.
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    22
 *
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    23
 */
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    24
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    25
#include "precompiled.hpp"
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    26
#include "gc/g1/g1CollectedHeap.inline.hpp"
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    27
#include "gc/g1/g1IHOPControl.hpp"
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
    28
#include "gc/g1/g1Predictions.hpp"
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    29
#include "gc/shared/gcTrace.hpp"
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
    30
#include "logging/log.hpp"
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    31
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    32
G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    33
  _initial_ihop_percent(initial_ihop_percent),
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    34
  _target_occupancy(target_occupancy),
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    35
  _last_allocated_bytes(0),
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    36
  _last_allocation_time_s(0.0)
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    37
{
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    38
  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);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    39
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    40
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    41
void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    42
  assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    43
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    44
  _last_allocation_time_s = allocation_time_s;
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    45
  _last_allocated_bytes = allocated_bytes;
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    46
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    47
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    48
void G1IHOPControl::print() {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    49
  size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
    50
  log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, "
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
    51
                      "recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
    52
                      cur_conc_mark_start_threshold,
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
    53
                      cur_conc_mark_start_threshold * 100.0 / _target_occupancy,
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
    54
                      _target_occupancy,
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
    55
                      G1CollectedHeap::heap()->used(),
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
    56
                      _last_allocated_bytes,
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
    57
                      _last_allocation_time_s * 1000.0,
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
    58
                      _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
    59
                      last_marking_length_s() * 1000.0);
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    60
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    61
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    62
void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    63
  tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    64
                                       _target_occupancy,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    65
                                       G1CollectedHeap::heap()->used(),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    66
                                       _last_allocated_bytes,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    67
                                       _last_allocation_time_s,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    68
                                       last_marking_length_s());
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    69
}
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
    70
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    71
G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    72
  G1IHOPControl(ihop_percent, target_occupancy),
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    73
  _last_marking_length_s(0.0) {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    74
  assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    75
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    76
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    77
#ifndef PRODUCT
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    78
static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    79
  for (int i = 0; i < 100; i++) {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    80
    ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    81
    ctrl->update_marking_length(mark_time);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    82
  }
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    83
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    84
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    85
void G1StaticIHOPControl::test() {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    86
  size_t const initial_ihop = 45;
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    87
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    88
  G1StaticIHOPControl ctrl(initial_ihop, 100);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    89
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    90
  size_t threshold = ctrl.get_conc_mark_start_threshold();
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    91
  assert(threshold == initial_ihop,
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    92
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    93
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    94
  ctrl.update_allocation_info(100.0, 100, 100);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    95
  threshold = ctrl.get_conc_mark_start_threshold();
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    96
  assert(threshold == initial_ihop,
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    97
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    98
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
    99
  ctrl.update_marking_length(1000.0);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   100
  threshold = ctrl.get_conc_mark_start_threshold();
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   101
  assert(threshold == initial_ihop,
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   102
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   103
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   104
  // Whatever we pass, the IHOP value must stay the same.
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   105
  test_update(&ctrl, 2, 10, 10, 3);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   106
  threshold = ctrl.get_conc_mark_start_threshold();
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   107
  assert(threshold == initial_ihop,
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   108
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   109
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   110
  test_update(&ctrl, 12, 10, 10, 3);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   111
  threshold = ctrl.get_conc_mark_start_threshold();
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   112
  assert(threshold == initial_ihop,
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   113
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   114
}
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   115
#endif
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   116
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   117
G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   118
                                             size_t initial_target_occupancy,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   119
                                             G1Predictions const* predictor,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   120
                                             size_t heap_reserve_percent,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   121
                                             size_t heap_waste_percent) :
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   122
  G1IHOPControl(ihop_percent, initial_target_occupancy),
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   123
  _predictor(predictor),
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   124
  _marking_times_s(10, 0.95),
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   125
  _allocation_rate_s(10, 0.95),
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   126
  _last_unrestrained_young_size(0),
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   127
  _heap_reserve_percent(heap_reserve_percent),
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   128
  _heap_waste_percent(heap_waste_percent)
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   129
{
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   130
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   131
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   132
size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   133
  // The actual target threshold takes the heap reserve and the expected waste in
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   134
  // free space  into account.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   135
  // _heap_reserve is that part of the total heap capacity that is reserved for
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   136
  // eventual promotion failure.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   137
  // _heap_waste is the amount of space will never be reclaimed in any
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   138
  // heap, so can not be used for allocation during marking and must always be
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   139
  // considered.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   140
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   141
  double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   142
35196
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   143
  return (size_t)MIN2(
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   144
    G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   145
    _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   146
    );
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   147
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   148
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   149
bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   150
  return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) &&
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   151
         ((size_t)_allocation_rate_s.num() >= G1AdaptiveIHOPNumInitialSamples);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   152
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   153
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   154
size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   155
  if (have_enough_data_for_prediction()) {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   156
    double pred_marking_time = _predictor->get_new_prediction(&_marking_times_s);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   157
    double pred_promotion_rate = _predictor->get_new_prediction(&_allocation_rate_s);
35196
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   158
    size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate);
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   159
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   160
    size_t predicted_needed_bytes_during_marking =
35196
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   161
      pred_promotion_size +
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   162
      // In reality we would need the maximum size of the young gen during
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   163
      // marking. This is a conservative estimate.
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   164
      _last_unrestrained_young_size;
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   165
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   166
    size_t internal_threshold = actual_target_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   167
    size_t predicted_initiating_threshold = predicted_needed_bytes_during_marking < internal_threshold ?
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   168
                                            internal_threshold - predicted_needed_bytes_during_marking :
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   169
                                            0;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   170
    return predicted_initiating_threshold;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   171
  } else {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   172
    // Use the initial value.
35196
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   173
    return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0);
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   174
  }
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   175
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   176
35196
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   177
void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s,
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   178
                                                   size_t allocated_bytes,
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35061
diff changeset
   179
                                                   size_t additional_buffer_size) {
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   180
  G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size);
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   181
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   182
  double allocation_rate = (double) allocated_bytes / allocation_time_s;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   183
  _allocation_rate_s.add(allocation_rate);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   184
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   185
  _last_unrestrained_young_size = additional_buffer_size;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   186
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   187
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   188
void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   189
   assert(marking_length_s >= 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   190
  _marking_times_s.add(marking_length_s);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   191
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   192
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   193
void G1AdaptiveIHOPControl::print() {
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   194
  G1IHOPControl::print();
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   195
  size_t actual_target = actual_target_threshold();
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
   196
  log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: " SIZE_FORMAT "B (%1.2f), internal target occupancy: " SIZE_FORMAT "B, "
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
   197
                      "occupancy: " SIZE_FORMAT "B, additional buffer size: " SIZE_FORMAT "B, predicted old gen allocation rate: %1.2fB/s, "
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
   198
                      "predicted marking phase length: %1.2fms, prediction active: %s",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
   199
                      get_conc_mark_start_threshold(),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
   200
                      percent_of(get_conc_mark_start_threshold(), actual_target),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
   201
                      actual_target,
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
   202
                      G1CollectedHeap::heap()->used(),
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
   203
                      _last_unrestrained_young_size,
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
   204
                      _predictor->get_new_prediction(&_allocation_rate_s),
36366
664ae1e77870 8140777: Make Adaptive IHOP logging information the same as JFR logging
tschatzl
parents: 35196
diff changeset
   205
                      _predictor->get_new_prediction(&_marking_times_s) * 1000.0,
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34300
diff changeset
   206
                      have_enough_data_for_prediction() ? "true" : "false");
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   207
}
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   208
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   209
void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   210
  G1IHOPControl::send_trace_event(tracer);
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   211
  tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   212
                                          actual_target_threshold(),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   213
                                          G1CollectedHeap::heap()->used(),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   214
                                          _last_unrestrained_young_size,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   215
                                          _predictor->get_new_prediction(&_allocation_rate_s),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   216
                                          _predictor->get_new_prediction(&_marking_times_s),
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   217
                                          have_enough_data_for_prediction());
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   218
}
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 34299
diff changeset
   219
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   220
#ifndef PRODUCT
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   221
void G1AdaptiveIHOPControl::test() {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   222
  size_t const initial_threshold = 45;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   223
  size_t const young_size = 10;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   224
  size_t const target_size = 100;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   225
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   226
  // The final IHOP value is always
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   227
  // target_size - (young_size + alloc_amount/alloc_time * marking_time)
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   228
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   229
  G1Predictions pred(0.95);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   230
  G1AdaptiveIHOPControl ctrl(initial_threshold, target_size, &pred, 0, 0);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   231
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   232
  // First "load".
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   233
  size_t const alloc_time1 = 2;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   234
  size_t const alloc_amount1 = 10;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   235
  size_t const marking_time1 = 2;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   236
  size_t const settled_ihop1 = target_size - (young_size + alloc_amount1/alloc_time1 * marking_time1);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   237
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   238
  size_t threshold;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   239
  threshold = ctrl.get_conc_mark_start_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   240
  assert(threshold == initial_threshold,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   241
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   242
  for (size_t i = 0; i < G1AdaptiveIHOPNumInitialSamples - 1; i++) {
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   243
    ctrl.update_allocation_info(alloc_time1, alloc_amount1, young_size);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   244
    ctrl.update_marking_length(marking_time1);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   245
    // Not enough data yet.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   246
    threshold = ctrl.get_conc_mark_start_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   247
    assert(threshold == initial_threshold,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   248
           "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   249
  }
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   250
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   251
  test_update(&ctrl, alloc_time1, alloc_amount1, young_size, marking_time1);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   252
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   253
  threshold = ctrl.get_conc_mark_start_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   254
  assert(threshold == settled_ihop1,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   255
         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   256
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   257
  // Second "load". A bit higher allocation rate.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   258
  size_t const alloc_time2 = 2;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   259
  size_t const alloc_amount2 = 30;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   260
  size_t const marking_time2 = 2;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   261
  size_t const settled_ihop2 = target_size - (young_size + alloc_amount2/alloc_time2 * marking_time2);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   262
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   263
  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   264
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   265
  threshold = ctrl.get_conc_mark_start_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   266
  assert(threshold < settled_ihop1,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   267
         "Expected IHOP threshold to settle at a value lower than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   268
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   269
  // Third "load". Very high (impossible) allocation rate.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   270
  size_t const alloc_time3 = 1;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   271
  size_t const alloc_amount3 = 50;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   272
  size_t const marking_time3 = 2;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   273
  size_t const settled_ihop3 = 0;
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   274
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   275
  test_update(&ctrl, alloc_time3, alloc_amount3, young_size, marking_time3);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   276
  threshold = ctrl.get_conc_mark_start_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   277
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   278
  assert(threshold == settled_ihop3,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   279
         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   280
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   281
  // And back to some arbitrary value.
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   282
  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   283
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   284
  threshold = ctrl.get_conc_mark_start_threshold();
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   285
  assert(threshold > settled_ihop3,
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   286
         "Expected IHOP threshold to settle at value larger than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   287
}
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   288
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   289
void IHOP_test() {
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   290
  G1StaticIHOPControl::test();
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   291
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
diff changeset
   292
#endif