8286189: G1: Change "wasted" memory to "unused" memory in reporting
Reviewed-by: iwalulya, ayang
This commit is contained in:
parent
c6eab989b7
commit
b9f4370325
@ -909,8 +909,8 @@ size_t G1CardSet::mem_size() const {
|
||||
_mm->mem_size();
|
||||
}
|
||||
|
||||
size_t G1CardSet::wasted_mem_size() const {
|
||||
return _mm->wasted_mem_size();
|
||||
size_t G1CardSet::unused_mem_size() const {
|
||||
return _mm->unused_mem_size();
|
||||
}
|
||||
|
||||
size_t G1CardSet::static_mem_size() {
|
||||
|
@ -324,7 +324,7 @@ public:
|
||||
|
||||
// Returns size of the actual remembered set containers in bytes.
|
||||
size_t mem_size() const;
|
||||
size_t wasted_mem_size() const;
|
||||
size_t unused_mem_size() const;
|
||||
// Returns the size of static data in bytes.
|
||||
static size_t static_mem_size();
|
||||
|
||||
|
@ -57,14 +57,14 @@ void G1CardSetAllocator::drop_all() {
|
||||
size_t G1CardSetAllocator::mem_size() const {
|
||||
return sizeof(*this) +
|
||||
_segmented_array.num_segments() * sizeof(G1CardSetSegment) +
|
||||
_segmented_array.num_available_slots() * _segmented_array.slot_size();
|
||||
_segmented_array.num_total_slots() * _segmented_array.slot_size();
|
||||
}
|
||||
|
||||
size_t G1CardSetAllocator::wasted_mem_size() const {
|
||||
uint num_wasted_slots = _segmented_array.num_available_slots() -
|
||||
size_t G1CardSetAllocator::unused_mem_size() const {
|
||||
uint num_unused_slots = _segmented_array.num_total_slots() -
|
||||
_segmented_array.num_allocated_slots() -
|
||||
(uint)_free_slots_list.pending_count();
|
||||
return num_wasted_slots * _segmented_array.slot_size();
|
||||
return num_unused_slots * _segmented_array.slot_size();
|
||||
}
|
||||
|
||||
uint G1CardSetAllocator::num_segments() const {
|
||||
@ -73,18 +73,18 @@ uint G1CardSetAllocator::num_segments() const {
|
||||
|
||||
void G1CardSetAllocator::print(outputStream* os) {
|
||||
uint num_allocated_slots = _segmented_array.num_allocated_slots();
|
||||
uint num_available_slots = _segmented_array.num_available_slots();
|
||||
uint num_total_slots = _segmented_array.num_total_slots();
|
||||
uint highest = _segmented_array.first_array_segment() != nullptr
|
||||
? _segmented_array.first_array_segment()->num_slots()
|
||||
: 0;
|
||||
uint num_segments = _segmented_array.num_segments();
|
||||
uint num_pending_slots = (uint)_free_slots_list.pending_count();
|
||||
os->print("MA " PTR_FORMAT ": %u slots pending (allocated %u available %u) used %.3f highest %u segments %u size %zu ",
|
||||
os->print("MA " PTR_FORMAT ": %u slots pending (allocated %u total %u) used %.3f highest %u segments %u size %zu ",
|
||||
p2i(this),
|
||||
num_pending_slots,
|
||||
num_allocated_slots,
|
||||
num_available_slots,
|
||||
percent_of(num_allocated_slots - num_pending_slots, num_available_slots),
|
||||
num_total_slots,
|
||||
percent_of(num_allocated_slots - num_pending_slots, num_total_slots),
|
||||
highest,
|
||||
num_segments,
|
||||
mem_size());
|
||||
@ -142,10 +142,10 @@ size_t G1CardSetMemoryManager::mem_size() const {
|
||||
(sizeof(G1CardSetAllocator) * num_mem_object_types());
|
||||
}
|
||||
|
||||
size_t G1CardSetMemoryManager::wasted_mem_size() const {
|
||||
size_t G1CardSetMemoryManager::unused_mem_size() const {
|
||||
size_t result = 0;
|
||||
for (uint i = 0; i < num_mem_object_types(); i++) {
|
||||
result += _allocators[i].wasted_mem_size();
|
||||
result += _allocators[i].unused_mem_size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -83,9 +83,11 @@ public:
|
||||
// be called in a globally synchronized area.
|
||||
void drop_all();
|
||||
|
||||
// Total memory allocated.
|
||||
size_t mem_size() const;
|
||||
|
||||
size_t wasted_mem_size() const;
|
||||
// Unused (but usable) memory.
|
||||
size_t unused_mem_size() const;
|
||||
|
||||
uint num_segments() const;
|
||||
|
||||
@ -119,7 +121,7 @@ public:
|
||||
void print(outputStream* os);
|
||||
|
||||
size_t mem_size() const;
|
||||
size_t wasted_mem_size() const;
|
||||
size_t unused_mem_size() const;
|
||||
|
||||
G1SegmentedArrayMemoryStats memory_stats() const;
|
||||
};
|
||||
|
@ -114,7 +114,7 @@ class RegionTypeCounter {
|
||||
private:
|
||||
const char* _name;
|
||||
|
||||
size_t _rs_wasted_mem_size;
|
||||
size_t _rs_unused_mem_size;
|
||||
size_t _rs_mem_size;
|
||||
size_t _cards_occupied;
|
||||
size_t _amount;
|
||||
@ -144,12 +144,12 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
RegionTypeCounter(const char* name) : _name(name), _rs_wasted_mem_size(0), _rs_mem_size(0), _cards_occupied(0),
|
||||
RegionTypeCounter(const char* name) : _name(name), _rs_unused_mem_size(0), _rs_mem_size(0), _cards_occupied(0),
|
||||
_amount(0), _amount_tracked(0), _code_root_mem_size(0), _code_root_elems(0) { }
|
||||
|
||||
void add(size_t rs_wasted_mem_size, size_t rs_mem_size, size_t cards_occupied,
|
||||
void add(size_t rs_unused_mem_size, size_t rs_mem_size, size_t cards_occupied,
|
||||
size_t code_root_mem_size, size_t code_root_elems, bool tracked) {
|
||||
_rs_wasted_mem_size += rs_wasted_mem_size;
|
||||
_rs_unused_mem_size += rs_unused_mem_size;
|
||||
_rs_mem_size += rs_mem_size;
|
||||
_cards_occupied += cards_occupied;
|
||||
_code_root_mem_size += code_root_mem_size;
|
||||
@ -158,7 +158,7 @@ public:
|
||||
_amount_tracked += tracked ? 1 : 0;
|
||||
}
|
||||
|
||||
size_t rs_wasted_mem_size() const { return _rs_wasted_mem_size; }
|
||||
size_t rs_unused_mem_size() const { return _rs_unused_mem_size; }
|
||||
size_t rs_mem_size() const { return _rs_mem_size; }
|
||||
size_t cards_occupied() const { return _cards_occupied; }
|
||||
|
||||
@ -167,10 +167,10 @@ public:
|
||||
|
||||
void print_rs_mem_info_on(outputStream * out, size_t total) {
|
||||
out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) by " SIZE_FORMAT " "
|
||||
"(" SIZE_FORMAT ") %s regions wasted " SIZE_FORMAT,
|
||||
"(" SIZE_FORMAT ") %s regions unused " SIZE_FORMAT,
|
||||
rs_mem_size(), rs_mem_size_percent_of(total),
|
||||
amount_tracked(), amount(),
|
||||
_name, rs_wasted_mem_size());
|
||||
_name, rs_unused_mem_size());
|
||||
}
|
||||
|
||||
void print_cards_occupied_info_on(outputStream * out, size_t total) {
|
||||
@ -206,7 +206,7 @@ private:
|
||||
size_t _max_rs_mem_sz;
|
||||
HeapRegion* _max_rs_mem_sz_region;
|
||||
|
||||
size_t total_rs_wasted_mem_sz() const { return _all.rs_wasted_mem_size(); }
|
||||
size_t total_rs_unused_mem_sz() const { return _all.rs_unused_mem_size(); }
|
||||
size_t total_rs_mem_sz() const { return _all.rs_mem_size(); }
|
||||
size_t total_cards_occupied() const { return _all.cards_occupied(); }
|
||||
|
||||
@ -234,7 +234,7 @@ public:
|
||||
|
||||
// HeapRegionRemSet::mem_size() includes the
|
||||
// size of the code roots
|
||||
size_t rs_wasted_mem_sz = hrrs->wasted_mem_size();
|
||||
size_t rs_unused_mem_sz = hrrs->unused_mem_size();
|
||||
size_t rs_mem_sz = hrrs->mem_size();
|
||||
if (rs_mem_sz > _max_rs_mem_sz) {
|
||||
_max_rs_mem_sz = rs_mem_sz;
|
||||
@ -262,9 +262,9 @@ public:
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
current->add(rs_wasted_mem_sz, rs_mem_sz, occupied_cards,
|
||||
current->add(rs_unused_mem_sz, rs_mem_sz, occupied_cards,
|
||||
code_root_mem_sz, code_root_elems, r->rem_set()->is_tracked());
|
||||
_all.add(rs_wasted_mem_sz, rs_mem_sz, occupied_cards,
|
||||
_all.add(rs_unused_mem_sz, rs_mem_sz, occupied_cards,
|
||||
code_root_mem_sz, code_root_elems, r->rem_set()->is_tracked());
|
||||
|
||||
return false;
|
||||
@ -275,10 +275,10 @@ public:
|
||||
|
||||
out->print_cr(" Current rem set statistics");
|
||||
out->print_cr(" Total per region rem sets sizes = " SIZE_FORMAT
|
||||
" Max = " SIZE_FORMAT " wasted = " SIZE_FORMAT,
|
||||
" Max = " SIZE_FORMAT " unused = " SIZE_FORMAT,
|
||||
total_rs_mem_sz(),
|
||||
max_rs_mem_sz(),
|
||||
total_rs_wasted_mem_sz());
|
||||
total_rs_unused_mem_sz());
|
||||
for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
|
||||
(*current)->print_rs_mem_info_on(out, total_rs_mem_sz());
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ G1SegmentedArraySegment* G1SegmentedArray::create_new_segment(G1SegmentedArraySe
|
||||
// Successfully installed the segment into the list.
|
||||
Atomic::inc(&_num_segments, memory_order_relaxed);
|
||||
Atomic::add(&_mem_size, next->mem_size(), memory_order_relaxed);
|
||||
Atomic::add(&_num_available_slots, next->num_slots(), memory_order_relaxed);
|
||||
Atomic::add(&_num_total_slots, next->num_slots(), memory_order_relaxed);
|
||||
return next;
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ G1SegmentedArray::G1SegmentedArray(const G1SegmentedArrayAllocOptions* alloc_opt
|
||||
_num_segments(0),
|
||||
_mem_size(0),
|
||||
_free_segment_list(free_segment_list),
|
||||
_num_available_slots(0),
|
||||
_num_total_slots(0),
|
||||
_num_allocated_slots(0) {
|
||||
assert(_free_segment_list != nullptr, "precondition!");
|
||||
}
|
||||
@ -182,7 +182,7 @@ void G1SegmentedArray::drop_all() {
|
||||
_last = nullptr;
|
||||
_num_segments = 0;
|
||||
_mem_size = 0;
|
||||
_num_available_slots = 0;
|
||||
_num_total_slots = 0;
|
||||
_num_allocated_slots = 0;
|
||||
}
|
||||
|
||||
|
@ -215,8 +215,8 @@ class G1SegmentedArray : public FreeListConfig {
|
||||
G1SegmentedArrayFreeList* _free_segment_list; // The global free segment list to preferentially
|
||||
// get new segments from.
|
||||
|
||||
volatile uint _num_available_slots; // Number of slots available in all segments (allocated + free + pending + not yet used).
|
||||
volatile uint _num_allocated_slots; // Number of total slots allocated and in use.
|
||||
volatile uint _num_total_slots; // Number of slots available in all segments (allocated + not yet used).
|
||||
volatile uint _num_allocated_slots; // Number of total slots allocated ever (including free and pending).
|
||||
|
||||
private:
|
||||
inline G1SegmentedArraySegment* create_new_segment(G1SegmentedArraySegment* const prev);
|
||||
@ -226,7 +226,7 @@ private:
|
||||
public:
|
||||
const G1SegmentedArraySegment* first_array_segment() const { return Atomic::load(&_first); }
|
||||
|
||||
uint num_available_slots() const { return Atomic::load(&_num_available_slots); }
|
||||
uint num_total_slots() const { return Atomic::load(&_num_total_slots); }
|
||||
uint num_allocated_slots() const {
|
||||
uint allocated = Atomic::load(&_num_allocated_slots);
|
||||
assert(calculate_length() == allocated, "Must be");
|
||||
|
@ -136,8 +136,8 @@ public:
|
||||
+ code_roots_mem_size();
|
||||
}
|
||||
|
||||
size_t wasted_mem_size() {
|
||||
return _card_set.wasted_mem_size();
|
||||
size_t unused_mem_size() {
|
||||
return _card_set.unused_mem_size();
|
||||
}
|
||||
|
||||
// Returns the memory occupancy of all static data structures associated
|
||||
|
Loading…
x
Reference in New Issue
Block a user