1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,194 @@ 1.4 +/* 1.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// PSGCAdaptivePolicyCounters is a holder class for performance counters 1.29 +// that track the data and decisions for the ergonomics policy for the 1.30 +// parallel scavenge collector. 1.31 + 1.32 +class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters { 1.33 + friend class VMStructs; 1.34 + 1.35 + private: 1.36 + // survivor space vs. tenuring threshold 1.37 + PerfVariable* _old_promo_size; 1.38 + PerfVariable* _old_eden_size; 1.39 + PerfVariable* _avg_promoted_avg_counter; 1.40 + PerfVariable* _avg_promoted_dev_counter; 1.41 + PerfVariable* _avg_promoted_padded_avg_counter; 1.42 + PerfVariable* _avg_pretenured_padded_avg; 1.43 + 1.44 + // young gen vs. old gen sizing 1.45 + PerfVariable* _avg_major_pause; 1.46 + PerfVariable* _avg_major_interval; 1.47 + PerfVariable* _live_space; 1.48 + PerfVariable* _free_space; 1.49 + PerfVariable* _avg_base_footprint; 1.50 + PerfVariable* _gc_time_limit_exceeded; 1.51 + PerfVariable* _live_at_last_full_gc; 1.52 + PerfVariable* _old_capacity; 1.53 + PerfVariable* _boundary_moved; 1.54 + 1.55 + PerfVariable* _change_old_gen_for_min_pauses; 1.56 + PerfVariable* _change_young_gen_for_maj_pauses_counter; 1.57 + 1.58 + PerfVariable* _major_pause_old_slope; 1.59 + PerfVariable* _minor_pause_old_slope; 1.60 + PerfVariable* _major_pause_young_slope; 1.61 + 1.62 + PerfVariable* _scavenge_skipped; 1.63 + PerfVariable* _full_follows_scavenge; 1.64 + 1.65 + // Use this time stamp if the gc time stamp is not available. 1.66 + TimeStamp _counter_time_stamp; 1.67 + 1.68 + protected: 1.69 + PSAdaptiveSizePolicy* ps_size_policy() { 1.70 + return (PSAdaptiveSizePolicy*)_size_policy; 1.71 + } 1.72 + 1.73 + public: 1.74 + PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations, 1.75 + PSAdaptiveSizePolicy* size_policy); 1.76 + inline void update_old_capacity(size_t size_in_bytes) { 1.77 + _old_capacity->set_value(size_in_bytes); 1.78 + } 1.79 + inline void update_old_eden_size(size_t old_size) { 1.80 + _old_eden_size->set_value(old_size); 1.81 + } 1.82 + inline void update_old_promo_size(size_t old_size) { 1.83 + _old_promo_size->set_value(old_size); 1.84 + } 1.85 + inline void update_boundary_moved(int size_in_bytes) { 1.86 + _boundary_moved->set_value(size_in_bytes); 1.87 + } 1.88 + inline void update_avg_promoted_avg() { 1.89 + _avg_promoted_avg_counter->set_value( 1.90 + (jlong)(ps_size_policy()->avg_promoted()->average()) 1.91 + ); 1.92 + } 1.93 + inline void update_avg_promoted_dev() { 1.94 + _avg_promoted_dev_counter->set_value( 1.95 + (jlong)(ps_size_policy()->avg_promoted()->deviation()) 1.96 + ); 1.97 + } 1.98 + inline void update_avg_promoted_padded_avg() { 1.99 + _avg_promoted_padded_avg_counter->set_value( 1.100 + (jlong)(ps_size_policy()->avg_promoted()->padded_average()) 1.101 + ); 1.102 + } 1.103 + 1.104 + inline void update_avg_pretenured_padded_avg() { 1.105 + _avg_pretenured_padded_avg->set_value( 1.106 + (jlong)(ps_size_policy()->_avg_pretenured->padded_average()) 1.107 + ); 1.108 + } 1.109 + inline void update_change_young_gen_for_maj_pauses() { 1.110 + _change_young_gen_for_maj_pauses_counter->set_value( 1.111 + ps_size_policy()->change_young_gen_for_maj_pauses()); 1.112 + } 1.113 + inline void update_change_old_gen_for_min_pauses() { 1.114 + _change_old_gen_for_min_pauses->set_value( 1.115 + ps_size_policy()->change_old_gen_for_min_pauses()); 1.116 + } 1.117 + 1.118 + // compute_generation_free_space() statistics 1.119 + 1.120 + inline void update_avg_major_pause() { 1.121 + _avg_major_pause->set_value( 1.122 + (jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0) 1.123 + ); 1.124 + } 1.125 + inline void update_avg_major_interval() { 1.126 + _avg_major_interval->set_value( 1.127 + (jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0) 1.128 + ); 1.129 + } 1.130 + 1.131 + inline void update_major_gc_cost_counter() { 1.132 + _major_gc_cost_counter->set_value( 1.133 + (jlong)(ps_size_policy()->major_gc_cost() * 100.0) 1.134 + ); 1.135 + } 1.136 + inline void update_mutator_cost_counter() { 1.137 + _mutator_cost_counter->set_value( 1.138 + (jlong)(ps_size_policy()->mutator_cost() * 100.0) 1.139 + ); 1.140 + } 1.141 + 1.142 + inline void update_live_space() { 1.143 + _live_space->set_value(ps_size_policy()->live_space()); 1.144 + } 1.145 + inline void update_free_space() { 1.146 + _free_space->set_value(ps_size_policy()->free_space()); 1.147 + } 1.148 + 1.149 + inline void update_avg_base_footprint() { 1.150 + _avg_base_footprint->set_value( 1.151 + (jlong)(ps_size_policy()->avg_base_footprint()->average()) 1.152 + ); 1.153 + } 1.154 + inline void update_avg_old_live() { 1.155 + _avg_old_live_counter->set_value( 1.156 + (jlong)(ps_size_policy()->avg_old_live()->average()) 1.157 + ); 1.158 + } 1.159 + // Scale up all the slopes 1.160 + inline void update_major_pause_old_slope() { 1.161 + _major_pause_old_slope->set_value( 1.162 + (jlong)(ps_size_policy()->major_pause_old_slope() * 1000) 1.163 + ); 1.164 + } 1.165 + inline void update_minor_pause_old_slope() { 1.166 + _minor_pause_old_slope->set_value( 1.167 + (jlong)(ps_size_policy()->minor_pause_old_slope() * 1000) 1.168 + ); 1.169 + } 1.170 + inline void update_major_pause_young_slope() { 1.171 + _major_pause_young_slope->set_value( 1.172 + (jlong)(ps_size_policy()->major_pause_young_slope() * 1000) 1.173 + ); 1.174 + } 1.175 + 1.176 + inline void update_scavenge_skipped(int cause) { 1.177 + _scavenge_skipped->set_value(cause); 1.178 + } 1.179 + 1.180 + inline void update_full_follows_scavenge(int event) { 1.181 + _full_follows_scavenge->set_value(event); 1.182 + } 1.183 + 1.184 + // Update all the counters that can be updated from the size policy. 1.185 + // This should be called after all policy changes have been made 1.186 + // and reflected internall in the size policy. 1.187 + void update_counters_from_policy(); 1.188 + 1.189 + // Update counters that can be updated from fields internal to the 1.190 + // counter or from globals. This is distinguished from counters 1.191 + // that are updated via input parameters. 1.192 + void update_counters(); 1.193 + 1.194 + virtual GCPolicyCounters::Name kind() const { 1.195 + return GCPolicyCounters::PSGCAdaptivePolicyCountersKind; 1.196 + } 1.197 +};