psAdaptiveSizePolicy.hpp revision 0
0N/A * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A// This class keeps statistical information and computes the 0N/A// optimal free space for both the young and old generation 0N/A// based on current application characteristics (based on gc cost 0N/A// and application footprint). 0N/A// It also computes an optimal tenuring threshold between the young 0N/A// and old generations, so as to equalize the cost of collections 0N/A// of those generations, as well as optimial survivor space sizes 0N/A// for the young generation. 0N/A// While this class is specifically intended for a generational system 0N/A// consisting of a young gen (containing an Eden and two semi-spaces) 0N/A// and a tenured gen, as well as a perm gen for reflective data, it 0N/A// makes NO references to specific generations. 0N/A// The 1.5 policy makes use of data gathered for the costs of GC on 0N/A// specific generations. That data does reference specific 0N/A// generation. Also diagnostics specific to generations have 0N/A // These values are used to record decisions made during the 0N/A // policy. For example, if the young generation was decreased 0N/A // to decrease the GC cost of minor collections the value 0N/A // decrease_young_gen_for_throughput_true is used. 0N/A // Last calculated sizes, in bytes, and aligned 0N/A // NEEDS_CLEANUP should use sizes.hpp, but it works in ints, not size_t's 0N/A // Footprint statistics 0N/A // Statistical data gathered for GC 0N/A // Variable for estimating the major and minor pause times. 0N/A // These variables represent linear least-squares fits of 0N/A // major pause time vs. old gen size 0N/A // major pause time vs. young gen size 0N/A // These record the most recent collection times. They 0N/A // are available as an alternative to using the averages 0N/A // for making ergonomic decisions. 0N/A // The amount of live data in the heap at the last full GC, used 0N/A // as a baseline to help us determine when we need to perform the 0N/A // Flag indicating that the adaptive policy is ready to use 0N/A // Changing the generation sizing depends on the data that is 0N/A // gathered about the effects of changes on the pause times and 0N/A // throughput. These variable count the number of data points 0N/A // gathered. The policy may use these counters as a threshhold 0N/A // for reliable data. 0N/A // To facilitate faster growth at start up, supplement the normal 0N/A // growth percentage for the young gen eden and the 0N/A // old gen space for promotion with these value which decay 0N/A // with increasing collections. 0N/A // The number of bytes absorbed from eden into the old gen by moving the 0N/A // boundary over live data. 0N/A // Change the young generation size to achieve a minor GC pause time goal 0N/A // Change the generation sizes to achieve a GC pause time goal 0N/A // Returned sizes are not necessarily aligned. 0N/A // Change the generation sizes to achieve an application throughput goal 0N/A // Returned sizes are not necessarily aligned. 0N/A // Change the generation sizes to achieve minimum footprint 0N/A // Returned sizes are not aligned. 0N/A // Size in bytes for an increment or decrement of eden. 0N/A // Size in bytes for an increment or decrement of the promotion area 0N/A // Decay the supplemental growth additive. 0N/A // Returns a change that has been scaled down. Result 0N/A // is not aligned. (If useful, move to some shared 0N/A // Footprint accessors 0N/A // Update estimators 0N/A // Use by ASPSYoungGen and ASPSOldGen to limit boundary moving. 0N/A // Accessors for use by performance counters 0N/A // Input arguments are initial free space sizes for young and old 0N/A // generations, the initial survivor space size, the 0N/A // alignment values and the pause & throughput goals. 0N/A // NEEDS_CLEANUP this is a singleton object 0N/A // Methods indicating events of interest to the adaptive size policy, 0N/A // called by GC algorithms. It is the responsibility of users of this 0N/A // policy to call these methods at the correct times! 0N/A // Return true if the old generation size was changed 0N/A // to try to reach a pause time goal. 0N/A // Return true if the young generation size was changed 0N/A // to try to reach a pause time goal. 0N/A // end flags for pause goal 0N/A // Return true if the old generation size was changed 0N/A // to try to reach a throughput goal. 0N/A // Return true if the young generation size was changed 0N/A // to try to reach a throughput goal. 0N/A // Accessors for estimators. The slope of the linear fit is 0N/A // currently all that is used for making decisions. 0N/A // Given the amount of live data in the heap, should we 0N/A // perform a Full GC? 0N/A // Calculates optimial free space sizes for both the old and young 0N/A // generations. Stores results in _eden_size and _promo_size. 0N/A // Takes current used space in all generations as input, as well 0N/A // as an indication if a full gc has just been performed, for use 0N/A // in deciding if an OOM error should be thrown. 0N/A // Calculates new survivor space size; returns a new tenuring threshold 0N/A // value. Stores new survivor size in _survivor_size. 0N/A // Return the maximum size of a survivor space if the young generation were of 0N/A // Never allow the target survivor size to grow more than MinSurvivorRatio 0N/A // of the young generation size. We cannot grow into a two semi-space 0N/A // system, with Eden zero sized. Even if the survivor space grows, from() 0N/A // might grow by moving the bottom boundary "down" -- so from space will 0N/A // remain almost full anyway (top() will be near end(), but there will be a 0N/A // large filler object at the bottom). 0N/A // Update averages that are always used (even 0N/A // if adaptive sizing is turned off).