src/hotspot/share/gc/g1/g1Analytics.cpp
author tschatzl
Fri, 29 Nov 2019 10:20:14 +0100
changeset 59319 9ee940f1de90
parent 59222 f4f60bb75ee4
child 59320 11ff4e485670
permissions -rw-r--r--
8227739: Merge cost predictions for scanning cards and log buffer entries Summary: Revamp the cost predictions for the changes in JDK-8200545 and JDK-8213108. Reviewed-by: sjohanss, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     1
/*
57953
d78c910f9069 8230109: G1DirtyCardQueueSet should use card counts rather than buffer counts
kbarrett
parents: 57875
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     4
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     8
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    13
 * accompanied this code).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    14
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5350
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5350
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5350
diff changeset
    21
 * questions.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    22
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    23
 */
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6759
diff changeset
    25
#include "precompiled.hpp"
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    26
#include "gc/g1/g1Analytics.hpp"
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    27
#include "gc/g1/g1Predictions.hpp"
57875
427b38332f20 8229836: Remove include of globals.hpp from allocation.hpp
stefank
parents: 57663
diff changeset
    28
#include "runtime/globals.hpp"
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    29
#include "runtime/os.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6759
diff changeset
    30
#include "utilities/debug.hpp"
59222
f4f60bb75ee4 8233597: Clean up code in G1Analytics::compute_pause_time_ratio
tschatzl
parents: 58798
diff changeset
    31
#include "utilities/globalDefinitions.hpp"
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    32
#include "utilities/numberSeq.hpp"
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    33
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    34
// Different defaults for different number of GC threads
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    35
// They were chosen by running GCOld and SPECjbb on debris with different
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    36
//   numbers of GC threads and choosing them based on the results
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    37
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    38
// all the same
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    39
static double rs_length_diff_defaults[] = {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    40
  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    41
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    42
57953
d78c910f9069 8230109: G1DirtyCardQueueSet should use card counts rather than buffer counts
kbarrett
parents: 57875
diff changeset
    43
static double cost_per_logged_card_ms_defaults[] = {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    44
  0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    45
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    46
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    47
// all the same
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    48
static double young_card_merge_to_scan_ratio_defaults[] = {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    49
  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    50
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    51
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    52
static double young_only_cost_per_card_scan_ms_defaults[] = {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    53
  0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    54
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    55
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    56
static double cost_per_byte_ms_defaults[] = {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    57
  0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    58
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    59
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    60
// these should be pretty consistent
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    61
static double constant_other_time_ms_defaults[] = {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    62
  5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    63
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    64
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    65
static double young_other_cost_per_region_ms_defaults[] = {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    66
  0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    67
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    68
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    69
static double non_young_other_cost_per_region_ms_defaults[] = {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    70
  1.0, 0.7, 0.7, 0.5, 0.5, 0.42, 0.42, 0.30
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    71
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    72
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    73
G1Analytics::G1Analytics(const G1Predictions* predictor) :
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    74
    _predictor(predictor),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    75
    _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    76
    _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    77
    _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    78
    _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    79
    _prev_collection_pause_end_ms(0.0),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    80
    _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
58508
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
    81
    _concurrent_refine_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
    82
    _logged_cards_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    83
    _young_card_merge_to_scan_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    84
    _mixed_card_merge_to_scan_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    85
    _young_cost_per_card_scan_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    86
    _mixed_cost_per_card_scan_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    87
    _young_cost_per_card_merge_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    88
    _mixed_cost_per_card_merge_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
    89
    _copy_cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    90
    _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    91
    _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    92
    _non_young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
    93
    _pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)),
57663
bf8e76d86d05 8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents: 55510
diff changeset
    94
    _rs_length_seq(new TruncatedSeq(TruncatedSeqLength)),
51332
c25572739e7c 8208669: GC changes to allow enabling -Wreorder
tschatzl
parents: 49643
diff changeset
    95
    _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
48010
cd8f5f780750 8182284: G1Analytics uses uninitialized fields
ehelin
parents: 47216
diff changeset
    96
    _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)),
cd8f5f780750 8182284: G1Analytics uses uninitialized fields
ehelin
parents: 47216
diff changeset
    97
    _recent_avg_pause_time_ratio(0.0),
cd8f5f780750 8182284: G1Analytics uses uninitialized fields
ehelin
parents: 47216
diff changeset
    98
    _last_pause_time_ratio(0.0) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    99
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   100
  // Seed sequences with initial values.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   101
  _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   102
  _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   103
36191
07d2ba48d1d3 8149013: Remove unused and dead code from G1CollectorPolicy
mgerdin
parents: 36102
diff changeset
   104
  int index = MIN2(ParallelGCThreads - 1, 7u);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   105
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   106
  _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
58508
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   107
  // Start with inverse of maximum STW cost.
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   108
  _concurrent_refine_rate_ms_seq->add(1/cost_per_logged_card_ms_defaults[0]);
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   109
  // Some applications have very low rates for logging cards.
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   110
  _logged_cards_rate_ms_seq->add(0.0);
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   111
  _young_card_merge_to_scan_ratio_seq->add(young_card_merge_to_scan_ratio_defaults[index]);
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   112
  _young_cost_per_card_scan_ms_seq->add(young_only_cost_per_card_scan_ms_defaults[index]);
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   113
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   114
  _copy_cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   115
  _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   116
  _young_other_cost_per_region_ms_seq->add(young_other_cost_per_region_ms_defaults[index]);
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   117
  _non_young_other_cost_per_region_ms_seq->add(non_young_other_cost_per_region_ms_defaults[index]);
15806
f3fb856749cf 8008546: Wrong G1ConfidencePercent results in GUARANTEE(VARIANCE() > -1.0) FAILED
poonam
parents: 15089
diff changeset
   118
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   119
  // start conservatively (around 50ms is about right)
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   120
  _concurrent_mark_remark_times_ms->add(0.05);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   121
  _concurrent_mark_cleanup_times_ms->add(0.20);
21561
c619b1cb4554 8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents: 21558
diff changeset
   122
}
c619b1cb4554 8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents: 21558
diff changeset
   123
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   124
bool G1Analytics::enough_samples_available(TruncatedSeq const* seq) const {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   125
  return seq->num() >= 3;
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   126
}
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   127
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   128
double G1Analytics::get_new_prediction(TruncatedSeq const* seq) const {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   129
  return _predictor->get_new_prediction(seq);
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 34134
diff changeset
   130
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 34134
diff changeset
   131
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   132
size_t G1Analytics::get_new_size_prediction(TruncatedSeq const* seq) const {
35196
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35163
diff changeset
   133
  return (size_t)get_new_prediction(seq);
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35163
diff changeset
   134
}
c83940b346b2 8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents: 35163
diff changeset
   135
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   136
int G1Analytics::num_alloc_rate_ms() const {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   137
  return _alloc_rate_ms_seq->num();
2009
4adf43957a1b 6484959: G1: introduce survivor spaces
apetrusenko
parents: 1902
diff changeset
   138
}
4adf43957a1b 6484959: G1: introduce survivor spaces
apetrusenko
parents: 1902
diff changeset
   139
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   140
void G1Analytics::report_concurrent_mark_remark_times_ms(double ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   141
  _concurrent_mark_remark_times_ms->add(ms);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   142
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   143
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   144
void G1Analytics::report_alloc_rate_ms(double alloc_rate) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   145
  _alloc_rate_ms_seq->add(alloc_rate);
33591
4a2823c696ce 8138975: G1CollectorPolicy::calculate_young_list_target_length should be const
ehelin
parents: 33218
diff changeset
   146
}
10528
06fab03478df 7084509: G1: fix inconsistencies and mistakes in the young list target length calculations
tonyp
parents: 10523
diff changeset
   147
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   148
void G1Analytics::compute_pause_time_ratio(double interval_ms, double pause_time_ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   149
  _recent_avg_pause_time_ratio = _recent_gc_times_ms->sum() / interval_ms;
59222
f4f60bb75ee4 8233597: Clean up code in G1Analytics::compute_pause_time_ratio
tschatzl
parents: 58798
diff changeset
   150
f4f60bb75ee4 8233597: Clean up code in G1Analytics::compute_pause_time_ratio
tschatzl
parents: 58798
diff changeset
   151
  // Clamp the result to [0.0 ... 1.0] to filter out nonsensical results due to bad input.
f4f60bb75ee4 8233597: Clean up code in G1Analytics::compute_pause_time_ratio
tschatzl
parents: 58798
diff changeset
   152
  _recent_avg_pause_time_ratio = clamp(_recent_avg_pause_time_ratio, 0.0, 1.0);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   153
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   154
  // Compute the ratio of just this last pause time to the entire time range stored
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   155
  // in the vectors. Comparing this pause to the entire range, rather than only the
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   156
  // most recent interval, has the effect of smoothing over a possible transient 'burst'
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   157
  // of more frequent pauses that don't really reflect a change in heap occupancy.
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   158
  // This reduces the likelihood of a needless heap expansion being triggered.
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   159
  _last_pause_time_ratio =
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   160
    (pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   161
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   162
58508
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   163
void G1Analytics::report_concurrent_refine_rate_ms(double cards_per_ms) {
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   164
  _concurrent_refine_rate_ms_seq->add(cards_per_ms);
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   165
}
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   166
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   167
void G1Analytics::report_logged_cards_rate_ms(double cards_per_ms) {
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   168
  _logged_cards_rate_ms_seq->add(cards_per_ms);
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   169
}
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   170
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   171
void G1Analytics::report_cost_per_card_scan_ms(double cost_per_card_ms, bool for_young_gc) {
49643
a3453bbd5418 8199742: Clean up state flags in G1CollectorState
tschatzl
parents: 48010
diff changeset
   172
  if (for_young_gc) {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   173
    _young_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
33810
8bbfb74d1f6c 8138740: Start initial mark right after mixed GC if needed
tschatzl
parents: 33809
diff changeset
   174
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   175
    _mixed_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
10280
3463715b5ef7 6814390: G1: remove the concept of non-generational G1
brutisso
parents: 10243
diff changeset
   176
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   177
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   178
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   179
void G1Analytics::report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_gc) {
49643
a3453bbd5418 8199742: Clean up state flags in G1CollectorState
tschatzl
parents: 48010
diff changeset
   180
  if (for_young_gc) {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   181
    _young_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   182
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   183
    _mixed_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   184
  }
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   185
}
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   186
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   187
void G1Analytics::report_card_merge_to_scan_ratio(double merge_to_scan_ratio, bool for_young_gc) {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   188
  if (for_young_gc) {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   189
    _young_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   190
  } else {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   191
    _mixed_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   192
  }
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   193
}
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   194
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   195
void G1Analytics::report_rs_length_diff(double rs_length_diff) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   196
  _rs_length_diff_seq->add(rs_length_diff);
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   197
}
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   198
49643
a3453bbd5418 8199742: Clean up state flags in G1CollectorState
tschatzl
parents: 48010
diff changeset
   199
void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress) {
a3453bbd5418 8199742: Clean up state flags in G1CollectorState
tschatzl
parents: 48010
diff changeset
   200
  if (mark_or_rebuild_in_progress) {
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   201
    _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   202
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   203
    _copy_cost_per_byte_ms_seq->add(cost_per_byte_ms);
34299
3fdfdda0ac1f 8136678: Implement adaptive sizing algorithm for IHOP
tschatzl
parents: 34298
diff changeset
   204
  }
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 34134
diff changeset
   205
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 34134
diff changeset
   206
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   207
void G1Analytics::report_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   208
  _young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 34134
diff changeset
   209
}
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 34134
diff changeset
   210
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   211
void G1Analytics::report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   212
  _non_young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
33738
1708291bd3d7 8140508: Add utility method for logging phases to G1CollectorPolicy
ehelin
parents: 33624
diff changeset
   213
}
1708291bd3d7 8140508: Add utility method for logging phases to G1CollectorPolicy
ehelin
parents: 33624
diff changeset
   214
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   215
void G1Analytics::report_constant_other_time_ms(double constant_other_time_ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   216
  _constant_other_time_ms_seq->add(constant_other_time_ms);
4481
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4458
diff changeset
   217
}
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4458
diff changeset
   218
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   219
void G1Analytics::report_pending_cards(double pending_cards) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   220
  _pending_cards_seq->add(pending_cards);
37051
b02a3fb98142 8150362: G1 base elapsed time prediction is wrong because rs_length prediction is wrong
sangheki
parents: 37041
diff changeset
   221
}
b02a3fb98142 8150362: G1 base elapsed time prediction is wrong because rs_length prediction is wrong
sangheki
parents: 37041
diff changeset
   222
57663
bf8e76d86d05 8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents: 55510
diff changeset
   223
void G1Analytics::report_rs_length(double rs_length) {
bf8e76d86d05 8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents: 55510
diff changeset
   224
  _rs_length_seq->add(rs_length);
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   225
}
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   226
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   227
double G1Analytics::predict_alloc_rate_ms() const {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   228
  return get_new_prediction(_alloc_rate_ms_seq);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   229
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   230
58508
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   231
double G1Analytics::predict_concurrent_refine_rate_ms() const {
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   232
  return get_new_prediction(_concurrent_refine_rate_ms_seq);
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   233
}
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   234
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   235
double G1Analytics::predict_logged_cards_rate_ms() const {
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   236
  return get_new_prediction(_logged_cards_rate_ms_seq);
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   237
}
d6058bd73982 8231153: Improve concurrent refinement statistics
kbarrett
parents: 57953
diff changeset
   238
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   239
double G1Analytics::predict_young_card_merge_to_scan_ratio() const {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   240
  return get_new_prediction(_young_card_merge_to_scan_ratio_seq);
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   241
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   242
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   243
size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_gc) const {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   244
  if (for_young_gc || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   245
    return (size_t) (rs_length * predict_young_card_merge_to_scan_ratio());
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   246
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   247
    return (size_t) (rs_length * get_new_prediction(_mixed_card_merge_to_scan_ratio_seq));
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   248
  }
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   249
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   250
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   251
double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   252
  if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq)) {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   253
    return card_num * get_new_prediction(_young_cost_per_card_merge_ms_seq);
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   254
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   255
    return card_num * get_new_prediction(_mixed_cost_per_card_merge_ms_seq);
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   256
  }
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   257
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   258
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   259
double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   260
  if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq)) {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   261
    return card_num * get_new_prediction(_young_cost_per_card_scan_ms_seq);
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   262
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   263
    return card_num * get_new_prediction(_mixed_cost_per_card_scan_ms_seq);
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   264
  }
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   265
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   266
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   267
double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   268
  if (!enough_samples_available(_cost_per_byte_ms_during_cm_seq)) {
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   269
    return (1.1 * bytes_to_copy) * get_new_prediction(_copy_cost_per_byte_ms_seq);
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   270
  } else {
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   271
    return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_during_cm_seq);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   272
  }
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   273
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   274
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   275
double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   276
  if (during_concurrent_mark) {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   277
    return predict_object_copy_time_ms_during_cm(bytes_to_copy);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   278
  } else {
59319
9ee940f1de90 8227739: Merge cost predictions for scanning cards and log buffer entries
tschatzl
parents: 59222
diff changeset
   279
    return bytes_to_copy * get_new_prediction(_copy_cost_per_byte_ms_seq);
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   280
  }
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   281
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   282
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   283
double G1Analytics::predict_constant_other_time_ms() const {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   284
  return get_new_prediction(_constant_other_time_ms_seq);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   285
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   286
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   287
double G1Analytics::predict_young_other_time_ms(size_t young_num) const {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   288
  return young_num * get_new_prediction(_young_other_cost_per_region_ms_seq);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   289
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   290
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   291
double G1Analytics::predict_non_young_other_time_ms(size_t non_young_num) const {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   292
  return non_young_num * get_new_prediction(_non_young_other_cost_per_region_ms_seq);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   293
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   294
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   295
double G1Analytics::predict_remark_time_ms() const {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   296
  return get_new_prediction(_concurrent_mark_remark_times_ms);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   297
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   298
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   299
double G1Analytics::predict_cleanup_time_ms() const {
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   300
  return get_new_prediction(_concurrent_mark_cleanup_times_ms);
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   301
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   302
57663
bf8e76d86d05 8228503: Rename "rs_lengths" to "rs_length" in ergo code
tschatzl
parents: 55510
diff changeset
   303
size_t G1Analytics::predict_rs_length() const {
58798
08e78887ff96 8232776: G1 should always take rs_length_diff into account when predicting rs_lengths
tschatzl
parents: 58508
diff changeset
   304
  return get_new_size_prediction(_rs_length_seq) + get_new_prediction(_rs_length_diff_seq);
33214
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   305
}
5a00fba36171 8137082: Factor out G1 prediction code from G1CollectorPolicy and clean up
tschatzl
parents: 33204
diff changeset
   306
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   307
size_t G1Analytics::predict_pending_cards() const {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   308
  return get_new_size_prediction(_pending_cards_seq);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   309
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   310
40523
20873f6704de 8164124: [BACKOUT] G1 does not implement millis_since_last_gc which is needed by RMI GC
jwilhelm
parents: 40328
diff changeset
   311
double G1Analytics::last_known_gc_end_time_sec() const {
40328
a2851f5f1cf6 8071770: G1 does not implement millis_since_last_gc which is needed by RMI GC
jprovino
parents: 38249
diff changeset
   312
  return _recent_prev_end_times_for_all_gcs_sec->oldest();
a2851f5f1cf6 8071770: G1 does not implement millis_since_last_gc which is needed by RMI GC
jprovino
parents: 38249
diff changeset
   313
}
a2851f5f1cf6 8071770: G1 does not implement millis_since_last_gc which is needed by RMI GC
jprovino
parents: 38249
diff changeset
   314
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   315
void G1Analytics::update_recent_gc_times(double end_time_sec,
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   316
                                         double pause_time_ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   317
  _recent_gc_times_ms->add(pause_time_ms);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   318
  _recent_prev_end_times_for_all_gcs_sec->add(end_time_sec);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   319
  _prev_collection_pause_end_ms = end_time_sec * 1000.0;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   320
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   321
37134
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   322
void G1Analytics::report_concurrent_mark_cleanup_times_ms(double ms) {
9dd3975ca940 8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents: 37080
diff changeset
   323
  _concurrent_mark_cleanup_times_ms->add(ms);
34619
83b1fedf01e9 8143251: HeapRetentionTest.java Test is failing on jdk9/dev
sjohanss
parents: 34611
diff changeset
   324
}