src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.cpp
author tschatzl
Fri, 29 Nov 2019 10:20:17 +0100
changeset 59321 5775e4825e58
parent 54085 ab87b06dfdc0
permissions -rw-r--r--
8233998: New young regions registered too early in collection set Reviewed-by: sangheki, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
54085
ab87b06dfdc0 8212206: Refactor AdaptiveSizePolicy to separate out code related to GC overhead
manc
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5343
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5343
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: 5343
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 7397
diff changeset
    26
#include "gc/parallel/psGCAdaptivePolicyCounters.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/arguments.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
PSGCAdaptivePolicyCounters::PSGCAdaptivePolicyCounters(const char* name_arg,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
                                      int collectors,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
                                      int generations,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
                                      PSAdaptiveSizePolicy* size_policy_arg)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
        : GCAdaptivePolicyCounters(name_arg,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
                                   collectors,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
                                   generations,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
                                   size_policy_arg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    EXCEPTION_MARK;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    const char* cname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    cname = PerfDataManager::counter_name(name_space(), "oldPromoSize");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    _old_promo_size = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      PerfData::U_Bytes, ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    cname = PerfDataManager::counter_name(name_space(), "oldEdenSize");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    _old_eden_size = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      PerfData::U_Bytes, ps_size_policy()->calculated_eden_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    cname = PerfDataManager::counter_name(name_space(), "oldCapacity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    _old_capacity = PerfDataManager::create_variable(SUN_GC, cname,
4434
4b41e5b42f81 6887571: Increase default heap config sizes
phh
parents: 1
diff changeset
    56
      PerfData::U_Bytes, (jlong) InitialHeapSize, CHECK);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    cname = PerfDataManager::counter_name(name_space(), "boundaryMoved");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    _boundary_moved = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
      PerfData::U_Bytes, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    cname = PerfDataManager::counter_name(name_space(), "avgPromotedAvg");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    _avg_promoted_avg_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
        ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    cname = PerfDataManager::counter_name(name_space(), "avgPromotedDev");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    _avg_promoted_dev_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        (jlong) 0 , CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    cname = PerfDataManager::counter_name(name_space(), "avgPromotedPaddedAvg");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    _avg_promoted_padded_avg_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
        ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    cname = PerfDataManager::counter_name(name_space(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
      "avgPretenuredPaddedAvg");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    _avg_pretenured_padded_avg =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    cname = PerfDataManager::counter_name(name_space(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
      "changeYoungGenForMajPauses");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    _change_young_gen_for_maj_pauses_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
        (jlong)0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    cname = PerfDataManager::counter_name(name_space(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      "changeOldGenForMinPauses");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    _change_old_gen_for_min_pauses =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
        (jlong)0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    cname = PerfDataManager::counter_name(name_space(), "avgMajorPauseTime");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    _avg_major_pause = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
      PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_pause->average(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    cname = PerfDataManager::counter_name(name_space(), "avgMajorIntervalTime");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    _avg_major_interval = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_interval->average(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    cname = PerfDataManager::counter_name(name_space(), "majorGcCost");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    _major_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
       PerfData::U_Ticks, (jlong) ps_size_policy()->major_gc_cost(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    cname = PerfDataManager::counter_name(name_space(), "liveSpace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    _live_space = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      PerfData::U_Bytes, ps_size_policy()->live_space(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    cname = PerfDataManager::counter_name(name_space(), "freeSpace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    _free_space = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
      PerfData::U_Bytes, ps_size_policy()->free_space(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    cname = PerfDataManager::counter_name(name_space(), "avgBaseFootprint");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    _avg_base_footprint = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      PerfData::U_Bytes, (jlong) ps_size_policy()->avg_base_footprint()->average(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    cname = PerfDataManager::counter_name(name_space(), "liveAtLastFullGc");
5343
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 4434
diff changeset
   122
    _live_at_last_full_gc_counter =
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 4434
diff changeset
   123
      PerfDataManager::create_variable(SUN_GC, cname,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      PerfData::U_Bytes, ps_size_policy()->live_at_last_full_gc(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    cname = PerfDataManager::counter_name(name_space(), "majorPauseOldSlope");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    _major_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
      PerfData::U_None, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    cname = PerfDataManager::counter_name(name_space(), "minorPauseOldSlope");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    _minor_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
      PerfData::U_None, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    cname = PerfDataManager::counter_name(name_space(), "majorPauseYoungSlope");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    _major_pause_young_slope = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
      PerfData::U_None, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    cname = PerfDataManager::counter_name(name_space(), "scavengeSkipped");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    _scavenge_skipped = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
      PerfData::U_Bytes, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    cname = PerfDataManager::counter_name(name_space(), "fullFollowsScavenge");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    _full_follows_scavenge = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
      PerfData::U_Bytes, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    _counter_time_stamp.update();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  assert(size_policy()->is_gc_ps_adaptive_size_policy(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    "Wrong type of size policy");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
void PSGCAdaptivePolicyCounters::update_counters_from_policy() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    GCAdaptivePolicyCounters::update_counters_from_policy();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    update_eden_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    update_promo_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    update_avg_old_live();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    update_survivor_size_counters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    update_avg_promoted_avg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    update_avg_promoted_dev();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    update_avg_promoted_padded_avg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    update_avg_pretenured_padded_avg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    update_avg_major_pause();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    update_avg_major_interval();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    update_minor_gc_cost_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    update_major_gc_cost_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    update_mutator_cost_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    update_decrement_tenuring_threshold_for_gc_cost();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    update_increment_tenuring_threshold_for_gc_cost();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    update_decrement_tenuring_threshold_for_survivor_limit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    update_live_space();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    update_free_space();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    update_avg_base_footprint();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    update_change_old_gen_for_maj_pauses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    update_change_young_gen_for_maj_pauses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    update_change_old_gen_for_min_pauses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    update_change_old_gen_for_throughput();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    update_change_young_gen_for_throughput();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    update_decrease_for_footprint();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    update_decide_at_full_gc_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    update_major_pause_old_slope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    update_minor_pause_old_slope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    update_major_pause_young_slope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
    update_minor_collection_slope_counter();
5343
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 4434
diff changeset
   191
    update_gc_overhead_limit_exceeded_counter();
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 4434
diff changeset
   192
    update_live_at_last_full_gc_counter();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
void PSGCAdaptivePolicyCounters::update_counters() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    update_counters_from_policy();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
}