mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8145301: Improve and unify the printout format for the g1HRPrinter
Reviewed-by: brutisso, tschatzl
This commit is contained in:
parent
f086798f2f
commit
ddab9e4387
5 changed files with 27 additions and 174 deletions
|
@ -353,7 +353,7 @@ bool G1ArchiveAllocator::alloc_new_region() {
|
||||||
assert(hr->is_empty(), "expected empty region (index %u)", hr->hrm_index());
|
assert(hr->is_empty(), "expected empty region (index %u)", hr->hrm_index());
|
||||||
hr->set_archive();
|
hr->set_archive();
|
||||||
_g1h->old_set_add(hr);
|
_g1h->old_set_add(hr);
|
||||||
_g1h->hr_printer()->alloc(hr, G1HRPrinter::Archive);
|
_g1h->hr_printer()->alloc(hr);
|
||||||
_allocated_regions.append(hr);
|
_allocated_regions.append(hr);
|
||||||
_allocation_region = hr;
|
_allocation_region = hr;
|
||||||
|
|
||||||
|
|
|
@ -410,11 +410,7 @@ G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
|
||||||
for (uint i = first; i <= last; ++i) {
|
for (uint i = first; i <= last; ++i) {
|
||||||
hr = region_at(i);
|
hr = region_at(i);
|
||||||
_humongous_set.add(hr);
|
_humongous_set.add(hr);
|
||||||
if (i == first) {
|
_hr_printer.alloc(hr);
|
||||||
_hr_printer.alloc(G1HRPrinter::StartsHumongous, hr, hr->top());
|
|
||||||
} else {
|
|
||||||
_hr_printer.alloc(G1HRPrinter::ContinuesHumongous, hr, hr->top());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_obj;
|
return new_obj;
|
||||||
|
@ -807,9 +803,9 @@ bool G1CollectedHeap::alloc_archive_regions(MemRegion* ranges, size_t count) {
|
||||||
while (curr_region != NULL) {
|
while (curr_region != NULL) {
|
||||||
assert(curr_region->is_empty() && !curr_region->is_pinned(),
|
assert(curr_region->is_empty() && !curr_region->is_pinned(),
|
||||||
"Region already in use (index %u)", curr_region->hrm_index());
|
"Region already in use (index %u)", curr_region->hrm_index());
|
||||||
_hr_printer.alloc(curr_region, G1HRPrinter::Archive);
|
|
||||||
curr_region->set_allocation_context(AllocationContext::system());
|
curr_region->set_allocation_context(AllocationContext::system());
|
||||||
curr_region->set_archive();
|
curr_region->set_archive();
|
||||||
|
_hr_printer.alloc(curr_region);
|
||||||
_old_set.add(curr_region);
|
_old_set.add(curr_region);
|
||||||
if (curr_region != last_region) {
|
if (curr_region != last_region) {
|
||||||
curr_region->set_top(curr_region->end());
|
curr_region->set_top(curr_region->end());
|
||||||
|
@ -1195,19 +1191,7 @@ private:
|
||||||
public:
|
public:
|
||||||
bool doHeapRegion(HeapRegion* hr) {
|
bool doHeapRegion(HeapRegion* hr) {
|
||||||
assert(!hr->is_young(), "not expecting to find young regions");
|
assert(!hr->is_young(), "not expecting to find young regions");
|
||||||
if (hr->is_free()) {
|
_hr_printer->post_compaction(hr);
|
||||||
// We only generate output for non-empty regions.
|
|
||||||
} else if (hr->is_starts_humongous()) {
|
|
||||||
_hr_printer->post_compaction(hr, G1HRPrinter::StartsHumongous);
|
|
||||||
} else if (hr->is_continues_humongous()) {
|
|
||||||
_hr_printer->post_compaction(hr, G1HRPrinter::ContinuesHumongous);
|
|
||||||
} else if (hr->is_archive()) {
|
|
||||||
_hr_printer->post_compaction(hr, G1HRPrinter::Archive);
|
|
||||||
} else if (hr->is_old()) {
|
|
||||||
_hr_printer->post_compaction(hr, G1HRPrinter::Old);
|
|
||||||
} else {
|
|
||||||
ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5967,7 +5951,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
|
||||||
false /* do_expand */);
|
false /* do_expand */);
|
||||||
if (new_alloc_region != NULL) {
|
if (new_alloc_region != NULL) {
|
||||||
set_region_short_lived_locked(new_alloc_region);
|
set_region_short_lived_locked(new_alloc_region);
|
||||||
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Eden, young_list_full);
|
_hr_printer.alloc(new_alloc_region, young_list_full);
|
||||||
check_bitmaps("Mutator Region Allocation", new_alloc_region);
|
check_bitmaps("Mutator Region Allocation", new_alloc_region);
|
||||||
return new_alloc_region;
|
return new_alloc_region;
|
||||||
}
|
}
|
||||||
|
@ -6008,13 +5992,12 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
|
||||||
new_alloc_region->record_timestamp();
|
new_alloc_region->record_timestamp();
|
||||||
if (is_survivor) {
|
if (is_survivor) {
|
||||||
new_alloc_region->set_survivor();
|
new_alloc_region->set_survivor();
|
||||||
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
|
|
||||||
check_bitmaps("Survivor Region Allocation", new_alloc_region);
|
check_bitmaps("Survivor Region Allocation", new_alloc_region);
|
||||||
} else {
|
} else {
|
||||||
new_alloc_region->set_old();
|
new_alloc_region->set_old();
|
||||||
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
|
|
||||||
check_bitmaps("Old Region Allocation", new_alloc_region);
|
check_bitmaps("Old Region Allocation", new_alloc_region);
|
||||||
}
|
}
|
||||||
|
_hr_printer.alloc(new_alloc_region);
|
||||||
bool during_im = collector_state()->during_initial_mark_pause();
|
bool during_im = collector_state()->during_initial_mark_pause();
|
||||||
new_alloc_region->note_start_of_copying(during_im);
|
new_alloc_region->note_start_of_copying(during_im);
|
||||||
return new_alloc_region;
|
return new_alloc_region;
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2011, 2015, 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/g1HRPrinter.hpp"
|
|
||||||
#include "gc/g1/heapRegion.hpp"
|
|
||||||
#include "utilities/ostream.hpp"
|
|
||||||
|
|
||||||
const char* G1HRPrinter::action_name(ActionType action) {
|
|
||||||
switch(action) {
|
|
||||||
case Alloc: return "ALLOC";
|
|
||||||
case AllocForce: return "ALLOC-FORCE";
|
|
||||||
case Retire: return "RETIRE";
|
|
||||||
case Reuse: return "REUSE";
|
|
||||||
case CSet: return "CSET";
|
|
||||||
case EvacFailure: return "EVAC-FAILURE";
|
|
||||||
case Cleanup: return "CLEANUP";
|
|
||||||
case PostCompaction: return "POST-COMPACTION";
|
|
||||||
case Commit: return "COMMIT";
|
|
||||||
case Uncommit: return "UNCOMMIT";
|
|
||||||
default: ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
// trying to keep the Windows compiler happy
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* G1HRPrinter::region_type_name(RegionType type) {
|
|
||||||
switch (type) {
|
|
||||||
case Unset: return NULL;
|
|
||||||
case Eden: return "Eden";
|
|
||||||
case Survivor: return "Survivor";
|
|
||||||
case Old: return "Old";
|
|
||||||
case StartsHumongous: return "StartsH";
|
|
||||||
case ContinuesHumongous: return "ContinuesH";
|
|
||||||
case Archive: return "Archive";
|
|
||||||
default: ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
// trying to keep the Windows compiler happy
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define G1HR_PREFIX " G1HR"
|
|
||||||
|
|
||||||
void G1HRPrinter::print(ActionType action, RegionType type,
|
|
||||||
HeapRegion* hr, HeapWord* top) {
|
|
||||||
const char* action_str = action_name(action);
|
|
||||||
const char* type_str = region_type_name(type);
|
|
||||||
HeapWord* bottom = hr->bottom();
|
|
||||||
|
|
||||||
if (type_str != NULL) {
|
|
||||||
if (top != NULL) {
|
|
||||||
log_trace(gc, region)(G1HR_PREFIX " %s(%s) " PTR_FORMAT " " PTR_FORMAT,
|
|
||||||
action_str, type_str, p2i(bottom), p2i(top));
|
|
||||||
} else {
|
|
||||||
log_trace(gc, region)(G1HR_PREFIX " %s(%s) " PTR_FORMAT,
|
|
||||||
action_str, type_str, p2i(bottom));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (top != NULL) {
|
|
||||||
log_trace(gc, region)(G1HR_PREFIX " %s " PTR_FORMAT " " PTR_FORMAT,
|
|
||||||
action_str, p2i(bottom), p2i(top));
|
|
||||||
} else {
|
|
||||||
log_trace(gc, region)(G1HR_PREFIX " %s " PTR_FORMAT,
|
|
||||||
action_str, p2i(bottom));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {
|
|
||||||
const char* action_str = action_name(action);
|
|
||||||
|
|
||||||
log_trace(gc, region)(G1HR_PREFIX " %s [" PTR_FORMAT "," PTR_FORMAT "]",
|
|
||||||
action_str, p2i(bottom), p2i(end));
|
|
||||||
}
|
|
|
@ -32,43 +32,14 @@
|
||||||
#define SKIP_RETIRED_FULL_REGIONS 1
|
#define SKIP_RETIRED_FULL_REGIONS 1
|
||||||
|
|
||||||
class G1HRPrinter VALUE_OBJ_CLASS_SPEC {
|
class G1HRPrinter VALUE_OBJ_CLASS_SPEC {
|
||||||
public:
|
|
||||||
typedef enum {
|
|
||||||
Alloc,
|
|
||||||
AllocForce,
|
|
||||||
Retire,
|
|
||||||
Reuse,
|
|
||||||
CSet,
|
|
||||||
EvacFailure,
|
|
||||||
Cleanup,
|
|
||||||
PostCompaction,
|
|
||||||
Commit,
|
|
||||||
Uncommit
|
|
||||||
} ActionType;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
Unset,
|
|
||||||
Eden,
|
|
||||||
Survivor,
|
|
||||||
Old,
|
|
||||||
StartsHumongous,
|
|
||||||
ContinuesHumongous,
|
|
||||||
Archive
|
|
||||||
} RegionType;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char* action_name(ActionType action);
|
|
||||||
static const char* region_type_name(RegionType type);
|
|
||||||
|
|
||||||
// Print an action event. This version is used in most scenarios and
|
// Print an action event.
|
||||||
// only prints the region's bottom. The parameters type and top are
|
static void print(const char* action, HeapRegion* hr) {
|
||||||
// optional (the "not set" values are Unset and NULL).
|
log_trace(gc, region)("G1HR %s(%s) [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]",
|
||||||
static void print(ActionType action, RegionType type,
|
action, hr->get_type_str(), p2i(hr->bottom()), p2i(hr->top()), p2i(hr->end()));
|
||||||
HeapRegion* hr, HeapWord* top);
|
}
|
||||||
|
|
||||||
// Print an action event. This version prints both the region's
|
|
||||||
// bottom and end. Used for Commit / Uncommit events.
|
|
||||||
static void print(ActionType action, HeapWord* bottom, HeapWord* end);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// In some places we iterate over a list in order to generate output
|
// In some places we iterate over a list in order to generate output
|
||||||
|
@ -76,67 +47,61 @@ public:
|
||||||
// iteration if the printer is not active.
|
// iteration if the printer is not active.
|
||||||
const bool is_active() { return log_is_enabled(Trace, gc, region); }
|
const bool is_active() { return log_is_enabled(Trace, gc, region); }
|
||||||
|
|
||||||
// The methods below are convenient wrappers for the print() methods.
|
// The methods below are convenient wrappers for the print() method.
|
||||||
|
|
||||||
void alloc(HeapRegion* hr, RegionType type, bool force = false) {
|
void alloc(HeapRegion* hr, bool force = false) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print((!force) ? Alloc : AllocForce, type, hr, NULL);
|
print((force) ? "ALLOC-FORCE" : "ALLOC", hr);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void alloc(RegionType type, HeapRegion* hr, HeapWord* top) {
|
|
||||||
if (is_active()) {
|
|
||||||
print(Alloc, type, hr, top);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void retire(HeapRegion* hr) {
|
void retire(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
if (!SKIP_RETIRED_FULL_REGIONS || hr->top() < hr->end()) {
|
if (!SKIP_RETIRED_FULL_REGIONS || hr->top() < hr->end()) {
|
||||||
print(Retire, Unset, hr, hr->top());
|
print("RETIRE", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reuse(HeapRegion* hr) {
|
void reuse(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(Reuse, Unset, hr, NULL);
|
print("REUSE", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cset(HeapRegion* hr) {
|
void cset(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(CSet, Unset, hr, NULL);
|
print("CSET", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void evac_failure(HeapRegion* hr) {
|
void evac_failure(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(EvacFailure, Unset, hr, NULL);
|
print("EVAC-FAILURE", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup(HeapRegion* hr) {
|
void cleanup(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(Cleanup, Unset, hr, NULL);
|
print("CLEANUP", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void post_compaction(HeapRegion* hr, RegionType type) {
|
void post_compaction(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(PostCompaction, type, hr, hr->top());
|
print("POST-COMPACTION", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void commit(HeapWord* bottom, HeapWord* end) {
|
void commit(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(Commit, bottom, end);
|
print("COMMIT", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uncommit(HeapWord* bottom, HeapWord* end) {
|
void uncommit(HeapRegion* hr) {
|
||||||
if (is_active()) {
|
if (is_active()) {
|
||||||
print(Uncommit, bottom, end);
|
print("UNCOMMIT", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -99,7 +99,7 @@ void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) {
|
||||||
if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
|
if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
|
||||||
for (uint i = start; i < start + num_regions; i++) {
|
for (uint i = start; i < start + num_regions; i++) {
|
||||||
HeapRegion* hr = at(i);
|
HeapRegion* hr = at(i);
|
||||||
G1CollectedHeap::heap()->hr_printer()->uncommit(hr->bottom(), hr->end());
|
G1CollectedHeap::heap()->hr_printer()->uncommit(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ void HeapRegionManager::make_regions_available(uint start, uint num_regions) {
|
||||||
assert(is_available(i), "Just made region %u available but is apparently not.", i);
|
assert(is_available(i), "Just made region %u available but is apparently not.", i);
|
||||||
HeapRegion* hr = at(i);
|
HeapRegion* hr = at(i);
|
||||||
if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
|
if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
|
||||||
G1CollectedHeap::heap()->hr_printer()->commit(hr->bottom(), hr->end());
|
G1CollectedHeap::heap()->hr_printer()->commit(hr);
|
||||||
}
|
}
|
||||||
HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(i);
|
HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(i);
|
||||||
MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
|
MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue