--- old/src/hotspot/share/gc/g1/g1CollectedHeap.cpp 2020-05-23 22:40:05.882708772 +0200 +++ new/src/hotspot/share/gc/g1/g1CollectedHeap.cpp 2020-05-23 22:40:05.638707563 +0200 @@ -47,6 +47,7 @@ #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1HotCardCache.hpp" +#include "gc/g1/g1InitLogger.hpp" #include "gc/g1/g1MemoryPool.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1ParallelCleaning.hpp" @@ -1824,6 +1825,8 @@ _collection_set.initialize(max_regions()); + G1InitLogger::print(); + return JNI_OK; } --- old/src/hotspot/share/gc/g1/heapRegion.cpp 2020-05-23 22:40:06.342711053 +0200 +++ new/src/hotspot/share/gc/g1/heapRegion.cpp 2020-05-23 22:40:06.074709725 +0200 @@ -89,7 +89,6 @@ // The cast to int is safe, given that we've bounded region_size by // MIN_REGION_SIZE and MAX_REGION_SIZE. GrainBytes = region_size; - log_info(gc, heap)("Heap region size: " SIZE_FORMAT "M", GrainBytes / M); guarantee(GrainWords == 0, "we should only set it once"); GrainWords = GrainBytes >> LogHeapWordSize; --- old/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp 2020-05-23 22:40:06.738713017 +0200 +++ new/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp 2020-05-23 22:40:06.470711688 +0200 @@ -37,6 +37,7 @@ #include "gc/shared/gcLocker.hpp" #include "gc/shared/gcWhen.hpp" #include "gc/shared/genArguments.hpp" +#include "gc/shared/gcInitLogger.hpp" #include "gc/shared/locationPrinter.inline.hpp" #include "gc/shared/scavengableNMethods.hpp" #include "logging/log.hpp" @@ -134,6 +135,8 @@ // Set up WorkGang _workers.initialize_workers(); + GCInitLogger::print(); + return JNI_OK; } --- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp 2020-05-23 22:40:07.146715040 +0200 +++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp 2020-05-23 22:40:06.870713672 +0200 @@ -47,6 +47,7 @@ #include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/genOopClosures.inline.hpp" #include "gc/shared/generationSpec.hpp" +#include "gc/shared/gcInitLogger.hpp" #include "gc/shared/locationPrinter.inline.hpp" #include "gc/shared/oopStorageParState.inline.hpp" #include "gc/shared/scavengableNMethods.hpp" @@ -130,6 +131,8 @@ _old_gen = _old_gen_spec->init(old_rs, rem_set()); clear_incremental_collection_failed(); + GCInitLogger::print(); + return JNI_OK; } --- old/src/hotspot/share/memory/universe.cpp 2020-05-23 22:40:07.582717202 +0200 +++ new/src/hotspot/share/memory/universe.cpp 2020-05-23 22:40:07.298715794 +0200 @@ -721,13 +721,9 @@ jint Universe::initialize_heap() { assert(_collectedHeap == NULL, "Heap already created"); _collectedHeap = GCConfig::arguments()->create_heap(); - jint status = _collectedHeap->initialize(); - if (status == JNI_OK) { - log_info(gc)("Using %s", _collectedHeap->name()); - } - - return status; + log_info(gc)("Using %s", _collectedHeap->name()); + return _collectedHeap->initialize(); } void Universe::initialize_tlab() { --- /dev/null 2020-05-08 09:21:34.500054546 +0200 +++ new/src/hotspot/share/gc/g1/g1InitLogger.cpp 2020-05-23 22:40:07.714717857 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/g1/g1InitLogger.hpp" +#include "logging/log.hpp" +#include "runtime/globals.hpp" +#include "utilities/globalDefinitions.hpp" + +void G1InitLogger::print_heap() { + log_info(gc, init)("Heap Region Size: " SIZE_FORMAT "M", G1HeapRegionSize / M); + GCInitLogger::print_heap(); +} + +void G1InitLogger::print_workers() { + GCInitLogger::print_workers(); + if (G1ConcRefinementThreads > 0) { + log_info(gc, init)("Concurrent Refinement Workers: %u", G1ConcRefinementThreads); + } +} + +void G1InitLogger::print() { + G1InitLogger init_log; + init_log.print_all(); +} --- /dev/null 2020-05-08 09:21:34.500054546 +0200 +++ new/src/hotspot/share/gc/g1/g1InitLogger.hpp 2020-05-23 22:40:08.118719860 +0200 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_GC_G1_G1INITLOGGER_HPP +#define SHARE_GC_G1_G1INITLOGGER_HPP + +#include "gc/shared/gcInitLogger.hpp" + +class G1InitLogger : public GCInitLogger { + protected: + virtual void print_heap(); + virtual void print_workers(); + + public: + static void print(); +}; + +#endif //SHARE_GC_G1_G1INITLOGGER_HPP --- /dev/null 2020-05-08 09:21:34.500054546 +0200 +++ new/src/hotspot/share/gc/shared/gcInitLogger.cpp 2020-05-23 22:40:08.518721844 +0200 @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/gcInitLogger.hpp" +#include "logging/log.hpp" +#include "oops/compressedOops.hpp" +#include "runtime/globals.hpp" +#include "runtime/vm_version.hpp" +#include "utilities/globalDefinitions.hpp" + +void GCInitLogger::print_all() { + print_version(); + print_cpu(); + print_memory(); + print_large_pages(); + print_numa(); + print_compressed_oops(); + print_heap(); + print_workers(); +} + +void GCInitLogger::print() { + GCInitLogger init_log; + init_log.print_all(); +} + +void GCInitLogger::print_version() { + log_info(gc, init)("Version: %s (%s)", + VM_Version::vm_release(), + VM_Version::jdk_debug_level()); +} + +void GCInitLogger::print_cpu() { + log_info(gc, init)("CPUs: %u total, %u available", + os::processor_count(), + os::initial_active_processor_count()); +} + +void GCInitLogger::print_memory() { + log_info(gc, init)("Memory: " JULONG_FORMAT "M", os::physical_memory() / M); +} + +void GCInitLogger::print_large_pages() { + log_info(gc, init)("Large Page Support: %s", large_pages_support()); +} + +void GCInitLogger::print_numa() { + if (UseNUMA) { + log_info(gc, init)("NUMA Support: Enabled"); + log_info(gc, init)("NUMA Nodes: " SIZE_FORMAT, os::numa_get_groups_num()); + } else { + log_info(gc, init)("NUMA Support: Disabled"); + } +} + +void GCInitLogger::print_compressed_oops() { + if (UseCompressedOops) { + log_info(gc, init)("Compressed Oops: Enabled (%s)", + CompressedOops::mode_to_string(CompressedOops::mode())); + } else { + log_info(gc, init)("Compressed Oops: Disabled"); + } +} + +void GCInitLogger::print_heap() { + log_info(gc, init)("Heap Min Capacity: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(MinHeapSize), exact_unit_for_byte_size(MinHeapSize)); + log_info(gc, init)("Heap Initial Capacity: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(InitialHeapSize), exact_unit_for_byte_size(InitialHeapSize)); + log_info(gc, init)("Heap Max Capacity: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(MaxHeapSize), exact_unit_for_byte_size(MaxHeapSize)); + + log_info(gc, init)("Pre-touch: %s", AlwaysPreTouch ? "Enabled" : "Disabled"); +} + +void GCInitLogger::print_workers() { + if (ParallelGCThreads > 0) { + log_info(gc, init)("Parallel Workers: %u", ParallelGCThreads); + } + if (ConcGCThreads > 0) { + log_info(gc, init)("Concurrent Workers: %u", ConcGCThreads); + } +} + +const char* GCInitLogger::large_pages_support() { + if (UseLargePages) { +#ifdef LINUX + if (UseTransparentHugePages) { + return "Enabled (Transparent)"; + } else { + return "Enabled (Explicit)"; + } +#else + return "Enabled"; +#endif + } else { + return "Disabled"; + } +} --- /dev/null 2020-05-08 09:21:34.500054546 +0200 +++ new/src/hotspot/share/gc/shared/gcInitLogger.hpp 2020-05-23 22:40:08.918723827 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_GC_SHARED_GCINITLOGGER_HPP +#define SHARE_GC_SHARED_GCINITLOGGER_HPP + +#include "memory/allocation.hpp" + +class GCInitLogger : public StackObj { + protected: + const char* large_pages_support(); + virtual void print_version(); + virtual void print_cpu(); + virtual void print_memory(); + virtual void print_large_pages(); + virtual void print_numa(); + virtual void print_compressed_oops(); + virtual void print_heap(); + virtual void print_workers(); + public: + void print_all(); + static void print(); +}; + +#endif //SHARE_GC_SHARED_GCINITLOGGER_HPP