8244817: Add configuration logging similar to ZGCs to other GCs
Reviewed-by: kbarrett, pliden, shade
This commit is contained in:
parent
039b259e94
commit
371a663180
@ -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 @@ jint G1CollectedHeap::initialize() {
|
||||
|
||||
_collection_set.initialize(max_regions());
|
||||
|
||||
G1InitLogger::print();
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
46
src/hotspot/share/gc/g1/g1InitLogger.cpp
Normal file
46
src/hotspot/share/gc/g1/g1InitLogger.cpp
Normal file
@ -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();
|
||||
}
|
39
src/hotspot/share/gc/g1/g1InitLogger.hpp
Normal file
39
src/hotspot/share/gc/g1/g1InitLogger.hpp
Normal file
@ -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
|
@ -89,7 +89,6 @@ void HeapRegion::setup_heap_region_size(size_t max_heap_size) {
|
||||
// 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;
|
||||
|
@ -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 @@ jint ParallelScavengeHeap::initialize() {
|
||||
// Set up WorkGang
|
||||
_workers.initialize_workers();
|
||||
|
||||
GCInitLogger::print();
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
123
src/hotspot/share/gc/shared/gcInitLogger.cpp
Normal file
123
src/hotspot/share/gc/shared/gcInitLogger.cpp
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* 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() {
|
||||
julong memory = os::physical_memory();
|
||||
log_info(gc, init)("Memory: " JULONG_FORMAT "%s",
|
||||
byte_size_in_proper_unit(memory), proper_unit_for_byte_size(memory));
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
46
src/hotspot/share/gc/shared/gcInitLogger.hpp
Normal file
46
src/hotspot/share/gc/shared/gcInitLogger.hpp
Normal file
@ -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
|
@ -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 @@ jint GenCollectedHeap::initialize() {
|
||||
_old_gen = _old_gen_spec->init(old_rs, rem_set());
|
||||
clear_incremental_collection_failed();
|
||||
|
||||
GCInitLogger::print();
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
@ -719,13 +719,9 @@ jint universe_init() {
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user