Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 33f8e70

Browse files
committedSep 16, 2020
8253173: Print heap before and after GC lacks a newline
Reviewed-by: tschatzl, pliden, rkennke, sjohanss
1 parent f509eb0 commit 33f8e70

File tree

3 files changed

+17
-24
lines changed

3 files changed

+17
-24
lines changed
 

‎src/hotspot/share/gc/shared/collectedHeap.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "gc/shared/gcWhen.hpp"
3737
#include "gc/shared/memAllocator.hpp"
3838
#include "logging/log.hpp"
39+
#include "logging/logStream.hpp"
3940
#include "memory/metaspace.hpp"
4041
#include "memory/resourceArea.hpp"
4142
#include "memory/universe.hpp"
@@ -123,14 +124,28 @@ MetaspaceSummary CollectedHeap::create_metaspace_summary() {
123124
}
124125

125126
void CollectedHeap::print_heap_before_gc() {
126-
Universe::print_heap_before_gc();
127+
LogTarget(Debug, gc, heap) lt;
128+
if (lt.is_enabled()) {
129+
LogStream ls(lt);
130+
ls.print_cr("Heap before GC invocations=%u (full %u):", total_collections(), total_full_collections());
131+
ResourceMark rm;
132+
print_on(&ls);
133+
}
134+
127135
if (_gc_heap_log != NULL) {
128136
_gc_heap_log->log_heap_before(this);
129137
}
130138
}
131139

132140
void CollectedHeap::print_heap_after_gc() {
133-
Universe::print_heap_after_gc();
141+
LogTarget(Debug, gc, heap) lt;
142+
if (lt.is_enabled()) {
143+
LogStream ls(lt);
144+
ls.print_cr("Heap after GC invocations=%u (full %u):", total_collections(), total_full_collections());
145+
ResourceMark rm;
146+
print_on(&ls);
147+
}
148+
134149
if (_gc_heap_log != NULL) {
135150
_gc_heap_log->log_heap_after(this);
136151
}

‎src/hotspot/share/memory/universe.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -1031,26 +1031,6 @@ void Universe::print_heap_at_SIGBREAK() {
10311031
}
10321032
}
10331033

1034-
void Universe::print_heap_before_gc() {
1035-
LogTarget(Debug, gc, heap) lt;
1036-
if (lt.is_enabled()) {
1037-
LogStream ls(lt);
1038-
ls.print("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1039-
ResourceMark rm;
1040-
heap()->print_on(&ls);
1041-
}
1042-
}
1043-
1044-
void Universe::print_heap_after_gc() {
1045-
LogTarget(Debug, gc, heap) lt;
1046-
if (lt.is_enabled()) {
1047-
LogStream ls(lt);
1048-
ls.print("Heap after GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1049-
ResourceMark rm;
1050-
heap()->print_on(&ls);
1051-
}
1052-
}
1053-
10541034
void Universe::initialize_verify_flags() {
10551035
verify_flags = 0;
10561036
const char delimiter[] = " ,";

‎src/hotspot/share/memory/universe.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ class Universe: AllStatic {
357357
static int verify_count() { return _verify_count; }
358358
static void print_on(outputStream* st);
359359
static void print_heap_at_SIGBREAK();
360-
static void print_heap_before_gc();
361-
static void print_heap_after_gc();
362360

363361
// Change the number of dummy objects kept reachable by the full gc dummy
364362
// array; this should trigger relocation in a sliding compaction collector.

0 commit comments

Comments
 (0)