1 /*
   2  * Copyright (c) 2020, Red Hat, Inc. 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 #include "gc/epsilon/epsilonHeap.hpp"
  27 #include "gc/epsilon/epsilonInitLogger.hpp"
  28 #include "logging/log.hpp"
  29 #include "runtime/globals.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 void EpsilonInitLogger::print_gc_specific() {
  33   // Warn users that non-resizable heap might be better for some configurations.
  34   // We are not adjusting the heap size by ourselves, because it affects startup time.
  35   if (InitialHeapSize != MaxHeapSize) {
  36     log_warning(gc, init)("Consider setting -Xms equal to -Xmx to avoid resizing hiccups");
  37   }
  38 
  39   // Warn users that AlwaysPreTouch might be better for some configurations.
  40   // We are not turning this on by ourselves, because it affects startup time.
  41   if (FLAG_IS_DEFAULT(AlwaysPreTouch) && !AlwaysPreTouch) {
  42     log_warning(gc, init)("Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups");
  43   }
  44 
  45   if (UseTLAB) {
  46     size_t max_tlab = EpsilonHeap::heap()->max_tlab_size() * HeapWordSize;
  47     log_info(gc, init)("TLAB Size Max: " SIZE_FORMAT "%s",
  48                        byte_size_in_exact_unit(max_tlab), exact_unit_for_byte_size(max_tlab));
  49     if (EpsilonElasticTLAB) {
  50       log_info(gc, init)("TLAB Size Elasticity: %.2fx", EpsilonTLABElasticity);
  51     }
  52     if (EpsilonElasticTLABDecay) {
  53       log_info(gc, init)("TLAB Size Decay Time: " SIZE_FORMAT "ms", EpsilonTLABDecayTime);
  54     }
  55   } else {
  56     log_info(gc, init)("TLAB: Disabled");
  57   }
  58 }
  59 
  60 void EpsilonInitLogger::print() {
  61   EpsilonInitLogger init_log;
  62   init_log.print_all();
  63 }