1 /* 2 * Copyright (c) 2020, Oracle and/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 #include "gc/shared/initLogger.hpp" 27 #include "logging/log.hpp" 28 #include "oops/compressedOops.hpp" 29 #include "runtime/globals.hpp" 30 #include "runtime/vm_version.hpp" 31 #include "utilities/globalDefinitions.hpp" 32 33 void InitLogger::print_all() { 34 print_version(); 35 print_cpu(); 36 print_memory(); 37 print_large_pages(); 38 print_numa(); 39 print_compressed_oops(); 40 print_heap(); 41 print_workers(); 42 } 43 44 void InitLogger::print() { 45 InitLogger init_log; 46 init_log.print_all(); 47 } 48 49 void InitLogger::print_version() { 50 log_info(gc, init)("Version: %s (%s)", 51 VM_Version::vm_release(), 52 VM_Version::jdk_debug_level()); 53 } 54 55 void InitLogger::print_cpu() { 56 log_info(gc, init)("CPUs: %u total, %u available", 57 os::processor_count(), 58 os::initial_active_processor_count()); 59 } 60 61 void InitLogger::print_memory() { 62 log_info(gc, init)("Memory: " JULONG_FORMAT "M", os::physical_memory() / M); 63 } 64 65 void InitLogger::print_large_pages() { 66 log_info(gc, init)("Large Page Support: %s", large_pages_support()); 67 } 68 69 void InitLogger::print_numa() { 70 if (UseNUMA) { 71 log_info(gc, init)("NUMA Support: Enabled"); 72 log_info(gc, init)("NUMA Nodes: " SIZE_FORMAT, os::numa_get_groups_num()); 73 } else { 74 log_info(gc, init)("NUMA Support: Disabled"); 75 } 76 } 77 78 void InitLogger::print_compressed_oops() { 79 if (UseCompressedOops) { 80 log_info(gc, init)("Compressed Oops: Enabled (%s)", 81 CompressedOops::mode_to_string(CompressedOops::mode())); 82 } else { 83 log_info(gc, init)("Compressed Oops: Disabled"); 84 } 85 } 86 87 void InitLogger::print_heap() { 88 log_info(gc, init)("Heap Min Capacity: " SIZE_FORMAT "%s", 89 byte_size_in_exact_unit(MinHeapSize), exact_unit_for_byte_size(MinHeapSize)); 90 log_info(gc, init)("Heap Initial Capacity: " SIZE_FORMAT "%s", 91 byte_size_in_exact_unit(InitialHeapSize), exact_unit_for_byte_size(InitialHeapSize)); 92 log_info(gc, init)("Heap Max Capacity: " SIZE_FORMAT "%s", 93 byte_size_in_exact_unit(MaxHeapSize), exact_unit_for_byte_size(MaxHeapSize)); 94 95 log_info(gc, init)("Pre-touch: %s", AlwaysPreTouch ? "Enabled" : "Disabled"); 96 } 97 98 void InitLogger::print_workers() { 99 if (ParallelGCThreads > 0) { 100 log_info(gc, init)("Parallel Workers: %u", ParallelGCThreads); 101 } 102 if (ConcGCThreads > 0) { 103 log_info(gc, init)("Concurrent Workers: %u", ConcGCThreads); 104 } 105 } 106 107 const char* InitLogger::large_pages_support() { 108 if (UseLargePages) { 109 #ifdef LINUX 110 if (UseTransparentHugePages) { 111 return "Enabled (Transparent)"; 112 } else { 113 return "Enabled (Explicit)"; 114 } 115 #else 116 return "Enabled"; 117 #endif 118 } else { 119 return "Disabled"; 120 } 121 }