Skip to content

Commit

Permalink
8253173: Print heap before and after GC lacks a newline
Browse files Browse the repository at this point in the history
Reviewed-by: tschatzl, pliden, rkennke, sjohanss
  • Loading branch information
stefank committed Sep 16, 2020
1 parent f509eb0 commit 33f8e70
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
19 changes: 17 additions & 2 deletions src/hotspot/share/gc/shared/collectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "gc/shared/gcWhen.hpp"
#include "gc/shared/memAllocator.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/metaspace.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
Expand Down Expand Up @@ -123,14 +124,28 @@ MetaspaceSummary CollectedHeap::create_metaspace_summary() {
}

void CollectedHeap::print_heap_before_gc() {
Universe::print_heap_before_gc();
LogTarget(Debug, gc, heap) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
ls.print_cr("Heap before GC invocations=%u (full %u):", total_collections(), total_full_collections());
ResourceMark rm;
print_on(&ls);
}

if (_gc_heap_log != NULL) {
_gc_heap_log->log_heap_before(this);
}
}

void CollectedHeap::print_heap_after_gc() {
Universe::print_heap_after_gc();
LogTarget(Debug, gc, heap) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
ls.print_cr("Heap after GC invocations=%u (full %u):", total_collections(), total_full_collections());
ResourceMark rm;
print_on(&ls);
}

if (_gc_heap_log != NULL) {
_gc_heap_log->log_heap_after(this);
}
Expand Down
20 changes: 0 additions & 20 deletions src/hotspot/share/memory/universe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,26 +1031,6 @@ void Universe::print_heap_at_SIGBREAK() {
}
}

void Universe::print_heap_before_gc() {
LogTarget(Debug, gc, heap) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
ls.print("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
ResourceMark rm;
heap()->print_on(&ls);
}
}

void Universe::print_heap_after_gc() {
LogTarget(Debug, gc, heap) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
ls.print("Heap after GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
ResourceMark rm;
heap()->print_on(&ls);
}
}

void Universe::initialize_verify_flags() {
verify_flags = 0;
const char delimiter[] = " ,";
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/memory/universe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ class Universe: AllStatic {
static int verify_count() { return _verify_count; }
static void print_on(outputStream* st);
static void print_heap_at_SIGBREAK();
static void print_heap_before_gc();
static void print_heap_after_gc();

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

1 comment on commit 33f8e70

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 33f8e70 Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.