hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp
author xdono
Thu, 02 Oct 2008 19:58:19 -0700
changeset 1217 5eb97f366a6a
parent 1 489c9b5090e2
child 4434 4b41e5b42f81
permissions -rw-r--r--
6754988: Update copyright year Summary: Update for files that have been modified starting July 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_psGCAdaptivePolicyCounters.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
PSGCAdaptivePolicyCounters::PSGCAdaptivePolicyCounters(const char* name_arg,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
                                      int collectors,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
                                      int generations,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
                                      PSAdaptiveSizePolicy* size_policy_arg)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
        : GCAdaptivePolicyCounters(name_arg,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
                                   collectors,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
                                   generations,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
                                   size_policy_arg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    EXCEPTION_MARK;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    const char* cname;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    cname = PerfDataManager::counter_name(name_space(), "oldPromoSize");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    _old_promo_size = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
      PerfData::U_Bytes, ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    cname = PerfDataManager::counter_name(name_space(), "oldEdenSize");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    _old_eden_size = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
      PerfData::U_Bytes, ps_size_policy()->calculated_eden_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    cname = PerfDataManager::counter_name(name_space(), "oldCapacity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    _old_capacity = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      PerfData::U_Bytes, (jlong) Arguments::initial_heap_size(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    cname = PerfDataManager::counter_name(name_space(), "boundaryMoved");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    _boundary_moved = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
      PerfData::U_Bytes, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    cname = PerfDataManager::counter_name(name_space(), "avgPromotedAvg");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    _avg_promoted_avg_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    cname = PerfDataManager::counter_name(name_space(), "avgPromotedDev");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    _avg_promoted_dev_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
        (jlong) 0 , CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    cname = PerfDataManager::counter_name(name_space(), "avgPromotedPaddedAvg");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    _avg_promoted_padded_avg_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
        ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    cname = PerfDataManager::counter_name(name_space(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      "avgPretenuredPaddedAvg");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    _avg_pretenured_padded_avg =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
        (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    cname = PerfDataManager::counter_name(name_space(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
      "changeYoungGenForMajPauses");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    _change_young_gen_for_maj_pauses_counter =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
        (jlong)0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    cname = PerfDataManager::counter_name(name_space(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
      "changeOldGenForMinPauses");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    _change_old_gen_for_min_pauses =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
        (jlong)0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    cname = PerfDataManager::counter_name(name_space(), "avgMajorPauseTime");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    _avg_major_pause = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_pause->average(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    cname = PerfDataManager::counter_name(name_space(), "avgMajorIntervalTime");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    _avg_major_interval = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_interval->average(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    cname = PerfDataManager::counter_name(name_space(), "majorGcCost");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    _major_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
       PerfData::U_Ticks, (jlong) ps_size_policy()->major_gc_cost(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    cname = PerfDataManager::counter_name(name_space(), "liveSpace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    _live_space = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
      PerfData::U_Bytes, ps_size_policy()->live_space(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    cname = PerfDataManager::counter_name(name_space(), "freeSpace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    _free_space = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      PerfData::U_Bytes, ps_size_policy()->free_space(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    cname = PerfDataManager::counter_name(name_space(), "avgBaseFootprint");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    _avg_base_footprint = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
      PerfData::U_Bytes, (jlong) ps_size_policy()->avg_base_footprint()->average(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    cname = PerfDataManager::counter_name(name_space(), "gcTimeLimitExceeded");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    _gc_time_limit_exceeded = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
      PerfData::U_Events, ps_size_policy()->gc_time_limit_exceeded(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    cname = PerfDataManager::counter_name(name_space(), "liveAtLastFullGc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    _live_at_last_full_gc = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      PerfData::U_Bytes, ps_size_policy()->live_at_last_full_gc(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    cname = PerfDataManager::counter_name(name_space(), "majorPauseOldSlope");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    _major_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      PerfData::U_None, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    cname = PerfDataManager::counter_name(name_space(), "minorPauseOldSlope");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    _minor_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
      PerfData::U_None, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    cname = PerfDataManager::counter_name(name_space(), "majorPauseYoungSlope");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    _major_pause_young_slope = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
      PerfData::U_None, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    cname = PerfDataManager::counter_name(name_space(), "scavengeSkipped");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    _scavenge_skipped = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
      PerfData::U_Bytes, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    cname = PerfDataManager::counter_name(name_space(), "fullFollowsScavenge");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    _full_follows_scavenge = PerfDataManager::create_variable(SUN_GC, cname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
      PerfData::U_Bytes, (jlong) 0, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    _counter_time_stamp.update();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  assert(size_policy()->is_gc_ps_adaptive_size_policy(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    "Wrong type of size policy");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
void PSGCAdaptivePolicyCounters::update_counters_from_policy() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    GCAdaptivePolicyCounters::update_counters_from_policy();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    update_eden_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    update_promo_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    update_avg_old_live();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    update_survivor_size_counters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    update_avg_promoted_avg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    update_avg_promoted_dev();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    update_avg_promoted_padded_avg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    update_avg_pretenured_padded_avg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    update_avg_major_pause();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    update_avg_major_interval();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    update_minor_gc_cost_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    update_major_gc_cost_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    update_mutator_cost_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    update_decrement_tenuring_threshold_for_gc_cost();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    update_increment_tenuring_threshold_for_gc_cost();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    update_decrement_tenuring_threshold_for_survivor_limit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    update_live_space();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    update_free_space();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    update_avg_base_footprint();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    update_change_old_gen_for_maj_pauses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    update_change_young_gen_for_maj_pauses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    update_change_old_gen_for_min_pauses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    update_change_old_gen_for_throughput();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    update_change_young_gen_for_throughput();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    update_decrease_for_footprint();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    update_decide_at_full_gc_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    update_major_pause_old_slope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    update_minor_pause_old_slope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
    update_major_pause_young_slope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    update_minor_collection_slope_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
void PSGCAdaptivePolicyCounters::update_counters() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    update_counters_from_policy();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}