1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,211 @@ 1.4 +/* 1.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP 1.29 +#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP 1.30 + 1.31 +#include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp" 1.32 +#include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp" 1.33 +#include "gc_implementation/shared/gcPolicyCounters.hpp" 1.34 + 1.35 +// PSGCAdaptivePolicyCounters is a holder class for performance counters 1.36 +// that track the data and decisions for the ergonomics policy for the 1.37 +// parallel scavenge collector. 1.38 + 1.39 +class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters { 1.40 + friend class VMStructs; 1.41 + 1.42 + private: 1.43 + // survivor space vs. tenuring threshold 1.44 + PerfVariable* _old_promo_size; 1.45 + PerfVariable* _old_eden_size; 1.46 + PerfVariable* _avg_promoted_avg_counter; 1.47 + PerfVariable* _avg_promoted_dev_counter; 1.48 + PerfVariable* _avg_promoted_padded_avg_counter; 1.49 + PerfVariable* _avg_pretenured_padded_avg; 1.50 + 1.51 + // young gen vs. old gen sizing 1.52 + PerfVariable* _avg_major_pause; 1.53 + PerfVariable* _avg_major_interval; 1.54 + PerfVariable* _live_space; 1.55 + PerfVariable* _free_space; 1.56 + PerfVariable* _avg_base_footprint; 1.57 + PerfVariable* _gc_overhead_limit_exceeded_counter; 1.58 + PerfVariable* _live_at_last_full_gc_counter; 1.59 + PerfVariable* _old_capacity; 1.60 + PerfVariable* _boundary_moved; 1.61 + 1.62 + PerfVariable* _change_old_gen_for_min_pauses; 1.63 + PerfVariable* _change_young_gen_for_maj_pauses_counter; 1.64 + 1.65 + PerfVariable* _major_pause_old_slope; 1.66 + PerfVariable* _minor_pause_old_slope; 1.67 + PerfVariable* _major_pause_young_slope; 1.68 + 1.69 + PerfVariable* _scavenge_skipped; 1.70 + PerfVariable* _full_follows_scavenge; 1.71 + 1.72 + // Use this time stamp if the gc time stamp is not available. 1.73 + TimeStamp _counter_time_stamp; 1.74 + 1.75 + protected: 1.76 + PSAdaptiveSizePolicy* ps_size_policy() { 1.77 + return (PSAdaptiveSizePolicy*)_size_policy; 1.78 + } 1.79 + 1.80 + public: 1.81 + PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations, 1.82 + PSAdaptiveSizePolicy* size_policy); 1.83 + inline void update_old_capacity(size_t size_in_bytes) { 1.84 + _old_capacity->set_value(size_in_bytes); 1.85 + } 1.86 + inline void update_old_eden_size(size_t old_size) { 1.87 + _old_eden_size->set_value(old_size); 1.88 + } 1.89 + inline void update_old_promo_size(size_t old_size) { 1.90 + _old_promo_size->set_value(old_size); 1.91 + } 1.92 + inline void update_boundary_moved(int size_in_bytes) { 1.93 + _boundary_moved->set_value(size_in_bytes); 1.94 + } 1.95 + inline void update_avg_promoted_avg() { 1.96 + _avg_promoted_avg_counter->set_value( 1.97 + (jlong)(ps_size_policy()->avg_promoted()->average()) 1.98 + ); 1.99 + } 1.100 + inline void update_avg_promoted_dev() { 1.101 + _avg_promoted_dev_counter->set_value( 1.102 + (jlong)(ps_size_policy()->avg_promoted()->deviation()) 1.103 + ); 1.104 + } 1.105 + inline void update_avg_promoted_padded_avg() { 1.106 + _avg_promoted_padded_avg_counter->set_value( 1.107 + (jlong)(ps_size_policy()->avg_promoted()->padded_average()) 1.108 + ); 1.109 + } 1.110 + 1.111 + inline void update_avg_pretenured_padded_avg() { 1.112 + _avg_pretenured_padded_avg->set_value( 1.113 + (jlong)(ps_size_policy()->_avg_pretenured->padded_average()) 1.114 + ); 1.115 + } 1.116 + inline void update_change_young_gen_for_maj_pauses() { 1.117 + _change_young_gen_for_maj_pauses_counter->set_value( 1.118 + ps_size_policy()->change_young_gen_for_maj_pauses()); 1.119 + } 1.120 + inline void update_change_old_gen_for_min_pauses() { 1.121 + _change_old_gen_for_min_pauses->set_value( 1.122 + ps_size_policy()->change_old_gen_for_min_pauses()); 1.123 + } 1.124 + 1.125 + // compute_generations_free_space() statistics 1.126 + 1.127 + inline void update_avg_major_pause() { 1.128 + _avg_major_pause->set_value( 1.129 + (jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0) 1.130 + ); 1.131 + } 1.132 + inline void update_avg_major_interval() { 1.133 + _avg_major_interval->set_value( 1.134 + (jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0) 1.135 + ); 1.136 + } 1.137 + 1.138 + inline void update_major_gc_cost_counter() { 1.139 + _major_gc_cost_counter->set_value( 1.140 + (jlong)(ps_size_policy()->major_gc_cost() * 100.0) 1.141 + ); 1.142 + } 1.143 + inline void update_mutator_cost_counter() { 1.144 + _mutator_cost_counter->set_value( 1.145 + (jlong)(ps_size_policy()->mutator_cost() * 100.0) 1.146 + ); 1.147 + } 1.148 + 1.149 + inline void update_live_space() { 1.150 + _live_space->set_value(ps_size_policy()->live_space()); 1.151 + } 1.152 + inline void update_free_space() { 1.153 + _free_space->set_value(ps_size_policy()->free_space()); 1.154 + } 1.155 + 1.156 + inline void update_avg_base_footprint() { 1.157 + _avg_base_footprint->set_value( 1.158 + (jlong)(ps_size_policy()->avg_base_footprint()->average()) 1.159 + ); 1.160 + } 1.161 + inline void update_avg_old_live() { 1.162 + _avg_old_live_counter->set_value( 1.163 + (jlong)(ps_size_policy()->avg_old_live()->average()) 1.164 + ); 1.165 + } 1.166 + // Scale up all the slopes 1.167 + inline void update_major_pause_old_slope() { 1.168 + _major_pause_old_slope->set_value( 1.169 + (jlong)(ps_size_policy()->major_pause_old_slope() * 1000) 1.170 + ); 1.171 + } 1.172 + inline void update_minor_pause_old_slope() { 1.173 + _minor_pause_old_slope->set_value( 1.174 + (jlong)(ps_size_policy()->minor_pause_old_slope() * 1000) 1.175 + ); 1.176 + } 1.177 + inline void update_major_pause_young_slope() { 1.178 + _major_pause_young_slope->set_value( 1.179 + (jlong)(ps_size_policy()->major_pause_young_slope() * 1000) 1.180 + ); 1.181 + } 1.182 + inline void update_gc_overhead_limit_exceeded_counter() { 1.183 + _gc_overhead_limit_exceeded_counter->set_value( 1.184 + (jlong) ps_size_policy()->gc_overhead_limit_exceeded()); 1.185 + } 1.186 + inline void update_live_at_last_full_gc_counter() { 1.187 + _live_at_last_full_gc_counter->set_value( 1.188 + (jlong)(ps_size_policy()->live_at_last_full_gc())); 1.189 + } 1.190 + 1.191 + inline void update_scavenge_skipped(int cause) { 1.192 + _scavenge_skipped->set_value(cause); 1.193 + } 1.194 + 1.195 + inline void update_full_follows_scavenge(int event) { 1.196 + _full_follows_scavenge->set_value(event); 1.197 + } 1.198 + 1.199 + // Update all the counters that can be updated from the size policy. 1.200 + // This should be called after all policy changes have been made 1.201 + // and reflected internall in the size policy. 1.202 + void update_counters_from_policy(); 1.203 + 1.204 + // Update counters that can be updated from fields internal to the 1.205 + // counter or from globals. This is distinguished from counters 1.206 + // that are updated via input parameters. 1.207 + void update_counters(); 1.208 + 1.209 + virtual GCPolicyCounters::Name kind() const { 1.210 + return GCPolicyCounters::PSGCAdaptivePolicyCountersKind; 1.211 + } 1.212 +}; 1.213 + 1.214 +#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSGCADAPTIVEPOLICYCOUNTERS_HPP