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/gcInitLogger.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 GCInitLogger::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 GCInitLogger::print() { 45 GCInitLogger init_log; 46 init_log.print_all(); 47 } 48 49 void GCInitLogger::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 GCInitLogger::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 GCInitLogger::print_memory() { 62 julong memory = os::physical_memory(); 63 log_info(gc, init)("Memory: " JULONG_FORMAT "%s", 64 byte_size_in_proper_unit(memory), proper_unit_for_byte_size(memory)); 65 } 66 67 void GCInitLogger::print_large_pages() { 68 log_info(gc, init)("Large Page Support: %s", large_pages_support()); 69 } 70 71 void GCInitLogger::print_numa() { 72 if (UseNUMA) { 73 log_info(gc, init)("NUMA Support: Enabled"); 74 log_info(gc, init)("NUMA Nodes: " SIZE_FORMAT, os::numa_get_groups_num()); 75 } else { 76 log_info(gc, init)("NUMA Support: Disabled"); 77 } 78 } 79 80 void GCInitLogger::print_compressed_oops() { 81 if (UseCompressedOops) { 82 log_info(gc, init)("Compressed Oops: Enabled (%s)", 83 CompressedOops::mode_to_string(CompressedOops::mode())); 84 } else { 85 log_info(gc, init)("Compressed Oops: Disabled"); 86 } 87 } 88 89 void GCInitLogger::print_heap() { 90 log_info(gc, init)("Heap Min Capacity: " SIZE_FORMAT "%s", 91 byte_size_in_exact_unit(MinHeapSize), exact_unit_for_byte_size(MinHeapSize)); 92 log_info(gc, init)("Heap Initial Capacity: " SIZE_FORMAT "%s", 93 byte_size_in_exact_unit(InitialHeapSize), exact_unit_for_byte_size(InitialHeapSize)); 94 log_info(gc, init)("Heap Max Capacity: " SIZE_FORMAT "%s", 95 byte_size_in_exact_unit(MaxHeapSize), exact_unit_for_byte_size(MaxHeapSize)); 96 97 log_info(gc, init)("Pre-touch: %s", AlwaysPreTouch ? "Enabled" : "Disabled"); 98 } 99 100 void GCInitLogger::print_workers() { 101 if (ParallelGCThreads > 0) { 102 log_info(gc, init)("Parallel Workers: %u", ParallelGCThreads); 103 } 104 if (ConcGCThreads > 0) { 105 log_info(gc, init)("Concurrent Workers: %u", ConcGCThreads); 106 } 107 } 108 109 const char* GCInitLogger::large_pages_support() { 110 if (UseLargePages) { 111 #ifdef LINUX 112 if (UseTransparentHugePages) { 113 return "Enabled (Transparent)"; 114 } else { 115 return "Enabled (Explicit)"; 116 } 117 #else 118 return "Enabled"; 119 #endif 120 } else { 121 return "Disabled"; 122 } 123 }