1 #ifdef USE_PRAGMA_IDENT_HDR 2 #pragma ident "@(#)generationSizer.hpp 1.17 07/05/05 17:05:27 JVM" 3 #endif 4 /* 5 * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. 6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 * 8 * This code is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License version 2 only, as 10 * published by the Free Software Foundation. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23 * CA 95054 USA or visit www.sun.com if you need additional information or 24 * have any questions. 25 * 26 */ 27 28 // There is a nice batch of tested generation sizing code in 29 // TwoGenerationCollectorPolicy. Lets reuse it! 30 31 class GenerationSizer : public TwoGenerationCollectorPolicy { 32 public: 33 GenerationSizer() { 34 // Partial init only! 35 initialize_flags(); 36 initialize_size_info(); 37 } 38 39 void initialize_flags() { 40 // Do basic sizing work 41 this->TwoGenerationCollectorPolicy::initialize_flags(); 42 43 // If the user hasn't explicitly set the number of worker 44 // threads, set the count. 45 if (ParallelGCThreads == 0) { 46 assert(UseParallelGC, "Setting ParallelGCThreads without UseParallelGC"); 47 ParallelGCThreads = os::active_processor_count(); 48 } 49 50 // The survivor ratio's are calculated "raw", unlike the 51 // default gc, which adds 2 to the ratio value. We need to 52 // make sure the values are valid before using them. 53 if (MinSurvivorRatio < 3) { 54 MinSurvivorRatio = 3; 55 } 56 57 if (InitialSurvivorRatio < 3) { 58 InitialSurvivorRatio = 3; 59 } 60 } 61 62 size_t min_young_gen_size() { return _min_gen0_size; } 63 size_t young_gen_size() { return _initial_gen0_size; } 64 size_t max_young_gen_size() { return _max_gen0_size; } 65 66 size_t min_old_gen_size() { return _min_gen1_size; } 67 size_t old_gen_size() { return _initial_gen1_size; } 68 size_t max_old_gen_size() { return _max_gen1_size; } 69 70 size_t perm_gen_size() { return PermSize; } 71 size_t max_perm_gen_size() { return MaxPermSize; } 72 }; 73 74