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/shenandoah/shenandoahHeap.inline.hpp"
27 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
28 #include "gc/shenandoah/shenandoahInitLogger.hpp"
29 #include "gc/shenandoah/shenandoahGeneration.hpp"
30 #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
31 #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
32 #include "gc/shenandoah/mode/shenandoahMode.hpp"
33 #include "logging/log.hpp"
34 #include "runtime/globals.hpp"
35 #include "utilities/globalDefinitions.hpp"
36 
37 void ShenandoahInitLogger::print_heap() {
38   GCInitLogger::print_heap();
39 
40   ShenandoahHeap* heap = ShenandoahHeap::heap();
41 
42   log_info(gc, init)("Mode: %s",
43                      heap->mode()->name());
44 
45   if (!heap->mode()->is_generational()) {
46     log_info(gc, init)("Heuristics: %s", heap->global_generation()->heuristics()->name());
47   } else {
48     log_info(gc, init)("Young Heuristics: %s", heap->young_generation()->heuristics()->name());
49     log_info(gc, init)("Old Heuristics: %s", heap->old_generation()->heuristics()->name());
50     log_info(gc, init)("Young Generation Max: " SIZE_FORMAT "%s",
51                        byte_size_in_proper_unit(heap->young_generation()->max_capacity()),
52                        proper_unit_for_byte_size(heap->young_generation()->max_capacity()));
53   }
54 
55 
56 
57   log_info(gc, init)("Heap Region Count: " SIZE_FORMAT,
58                      ShenandoahHeapRegion::region_count());
59 
60   log_info(gc, init)("Heap Region Size: " SIZE_FORMAT "%s",
61                      byte_size_in_exact_unit(ShenandoahHeapRegion::region_size_bytes()),
62                      exact_unit_for_byte_size(ShenandoahHeapRegion::region_size_bytes()));
63 
64   log_info(gc, init)("TLAB Size Max: " SIZE_FORMAT "%s",
65                      byte_size_in_exact_unit(ShenandoahHeapRegion::max_tlab_size_bytes()),
66                      exact_unit_for_byte_size(ShenandoahHeapRegion::max_tlab_size_bytes()));
67 
68   log_info(gc, init)("Humongous Object Threshold: " SIZE_FORMAT "%s",
69           byte_size_in_exact_unit(ShenandoahHeapRegion::humongous_threshold_bytes()),
70           exact_unit_for_byte_size(ShenandoahHeapRegion::humongous_threshold_bytes()));
71 }
72 
73 void ShenandoahInitLogger::print() {
74   ShenandoahInitLogger init_log;
75   init_log.print_all();
76 }