1 /* 2 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 27 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp" 28 #include "gc/shenandoah/shenandoahHeap.inline.hpp" 29 #include "gc/shenandoah/shenandoahInitLogger.hpp" 30 #include "gc/shenandoah/shenandoahOldGeneration.hpp" 31 #include "gc/shenandoah/shenandoahYoungGeneration.hpp" 32 33 #include "logging/log.hpp" 34 35 class ShenandoahGenerationalInitLogger : public ShenandoahInitLogger { 36 public: 37 static void print() { 38 ShenandoahGenerationalInitLogger logger; 39 logger.print_all(); 40 } 41 42 void print_heap() override { 43 ShenandoahInitLogger::print_heap(); 44 45 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap(); 46 47 ShenandoahYoungGeneration* young = heap->young_generation(); 48 log_info(gc, init)("Young Generation Soft Size: " PROPERFMT, PROPERFMTARGS(young->soft_max_capacity())); 49 log_info(gc, init)("Young Generation Max: " PROPERFMT, PROPERFMTARGS(young->max_capacity())); 50 51 ShenandoahOldGeneration* old = heap->old_generation(); 52 log_info(gc, init)("Old Generation Soft Size: " PROPERFMT, PROPERFMTARGS(old->soft_max_capacity())); 53 log_info(gc, init)("Old Generation Max: " PROPERFMT, PROPERFMTARGS(old->max_capacity())); 54 } 55 56 protected: 57 void print_gc_specific() override { 58 ShenandoahInitLogger::print_gc_specific(); 59 60 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap(); 61 log_info(gc, init)("Young Heuristics: %s", heap->young_generation()->heuristics()->name()); 62 log_info(gc, init)("Old Heuristics: %s", heap->old_generation()->heuristics()->name()); 63 } 64 }; 65 66 ShenandoahGenerationalHeap* ShenandoahGenerationalHeap::heap() { 67 CollectedHeap* heap = Universe::heap(); 68 return checked_cast<ShenandoahGenerationalHeap*>(heap); 69 } 70 71 void ShenandoahGenerationalHeap::print_init_logger() const { 72 ShenandoahGenerationalInitLogger logger; 73 logger.print_all(); 74 }