8293850: need a largest_committed metric for each category of NMT's output
Reviewed-by: gziemski, jsjolen
This commit is contained in:
parent
5a2e151d48
commit
8647f001bb
src/hotspot/share/services
@ -50,10 +50,13 @@ size_t MemReporterBase::committed_total(const MallocMemory* malloc, const Virtua
|
||||
return malloc->malloc_size() + malloc->arena_size() + vm->committed();
|
||||
}
|
||||
|
||||
void MemReporterBase::print_total(size_t reserved, size_t committed) const {
|
||||
void MemReporterBase::print_total(size_t reserved, size_t committed, size_t peak) const {
|
||||
const char* scale = current_scale();
|
||||
output()->print("reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s",
|
||||
amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale);
|
||||
if (peak != 0) {
|
||||
output()->print(", largest_committed=" SIZE_FORMAT "%s", amount_in_current_scale(peak), scale);
|
||||
}
|
||||
}
|
||||
|
||||
void MemReporterBase::print_malloc(const MemoryCounter* c, MEMFLAGS flag) const {
|
||||
@ -89,10 +92,10 @@ void MemReporterBase::print_malloc(const MemoryCounter* c, MEMFLAGS flag) const
|
||||
}
|
||||
}
|
||||
|
||||
void MemReporterBase::print_virtual_memory(size_t reserved, size_t committed) const {
|
||||
void MemReporterBase::print_virtual_memory(size_t reserved, size_t committed, size_t peak) const {
|
||||
const char* scale = current_scale();
|
||||
output()->print("(mmap: reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s)",
|
||||
amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale);
|
||||
output()->print("(mmap: reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s, largest_committed=" SIZE_FORMAT "%s)",
|
||||
amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale, amount_in_current_scale(peak), scale);
|
||||
}
|
||||
|
||||
void MemReporterBase::print_malloc_line(const MemoryCounter* c) const {
|
||||
@ -101,9 +104,9 @@ void MemReporterBase::print_malloc_line(const MemoryCounter* c) const {
|
||||
output()->print_cr(" ");
|
||||
}
|
||||
|
||||
void MemReporterBase::print_virtual_memory_line(size_t reserved, size_t committed) const {
|
||||
void MemReporterBase::print_virtual_memory_line(size_t reserved, size_t committed, size_t peak) const {
|
||||
output()->print("%28s", " ");
|
||||
print_virtual_memory(reserved, committed);
|
||||
print_virtual_memory(reserved, committed, peak);
|
||||
output()->print_cr(" ");
|
||||
}
|
||||
|
||||
@ -228,7 +231,7 @@ void MemSummaryReporter::report_summary_of_type(MEMFLAGS flag,
|
||||
// report thread count
|
||||
out->print_cr("%27s (threads #" SIZE_FORMAT ")", " ", ThreadStackTracker::thread_count());
|
||||
out->print("%27s (stack: ", " ");
|
||||
print_total(thread_stack_usage->reserved(), thread_stack_usage->committed());
|
||||
print_total(thread_stack_usage->reserved(), thread_stack_usage->committed(), thread_stack_usage->peak_size());
|
||||
} else {
|
||||
MallocMemory* thread_stack_memory = _malloc_snapshot->by_type(mtThreadStack);
|
||||
const char* scale = current_scale();
|
||||
@ -247,8 +250,9 @@ void MemSummaryReporter::report_summary_of_type(MEMFLAGS flag,
|
||||
print_malloc_line(malloc_memory->malloc_counter());
|
||||
}
|
||||
|
||||
if (amount_in_current_scale(virtual_memory->reserved()) > 0) {
|
||||
print_virtual_memory_line(virtual_memory->reserved(), virtual_memory->committed());
|
||||
if (amount_in_current_scale(virtual_memory->reserved()) > 0
|
||||
DEBUG_ONLY(|| amount_in_current_scale(virtual_memory->peak_size()) > 0)) {
|
||||
print_virtual_memory_line(virtual_memory->reserved(), virtual_memory->committed(), virtual_memory->peak_size());
|
||||
}
|
||||
|
||||
if (amount_in_current_scale(malloc_memory->arena_size()) > 0
|
||||
|
@ -107,12 +107,12 @@ class MemReporterBase : public StackObj {
|
||||
}
|
||||
|
||||
// Print summary total, malloc and virtual memory
|
||||
void print_total(size_t reserved, size_t committed) const;
|
||||
void print_total(size_t reserved, size_t committed, size_t peak = 0) const;
|
||||
void print_malloc(const MemoryCounter* c, MEMFLAGS flag = mtNone) const;
|
||||
void print_virtual_memory(size_t reserved, size_t committed) const;
|
||||
void print_virtual_memory(size_t reserved, size_t committed, size_t peak) const;
|
||||
|
||||
void print_malloc_line(const MemoryCounter* c) const;
|
||||
void print_virtual_memory_line(size_t reserved, size_t committed) const;
|
||||
void print_virtual_memory_line(size_t reserved, size_t committed, size_t peak) const;
|
||||
void print_arena_line(const MemoryCounter* c) const;
|
||||
|
||||
void print_virtual_memory_region(const char* type, address base, size_t size) const;
|
||||
|
@ -34,6 +34,20 @@
|
||||
|
||||
size_t VirtualMemorySummary::_snapshot[CALC_OBJ_SIZE_IN_TYPE(VirtualMemorySnapshot, size_t)];
|
||||
|
||||
#ifdef ASSERT
|
||||
void VirtualMemory::update_peak(size_t size) {
|
||||
size_t peak_sz = peak_size();
|
||||
while (peak_sz < size) {
|
||||
size_t old_sz = Atomic::cmpxchg(&_peak_size, peak_sz, size, memory_order_relaxed);
|
||||
if (old_sz == peak_sz) {
|
||||
break;
|
||||
} else {
|
||||
peak_sz = old_sz;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
void VirtualMemorySummary::initialize() {
|
||||
assert(sizeof(_snapshot) >= sizeof(VirtualMemorySnapshot), "Sanity Check");
|
||||
// Use placement operator new to initialize static data area.
|
||||
|
@ -43,12 +43,20 @@ class VirtualMemory {
|
||||
size_t _reserved;
|
||||
size_t _committed;
|
||||
|
||||
#ifdef ASSERT
|
||||
volatile size_t _peak_size;
|
||||
void update_peak(size_t size);
|
||||
#endif // ASSERT
|
||||
|
||||
public:
|
||||
VirtualMemory() : _reserved(0), _committed(0) { }
|
||||
VirtualMemory() : _reserved(0), _committed(0) {
|
||||
DEBUG_ONLY(_peak_size = 0;)
|
||||
}
|
||||
|
||||
inline void reserve_memory(size_t sz) { _reserved += sz; }
|
||||
inline void commit_memory (size_t sz) {
|
||||
_committed += sz;
|
||||
DEBUG_ONLY(update_peak(sz);)
|
||||
assert(_committed <= _reserved, "Sanity check");
|
||||
}
|
||||
|
||||
@ -64,6 +72,9 @@ class VirtualMemory {
|
||||
|
||||
inline size_t reserved() const { return _reserved; }
|
||||
inline size_t committed() const { return _committed; }
|
||||
inline size_t peak_size() const {
|
||||
return DEBUG_ONLY(Atomic::load(&_peak_size)) NOT_DEBUG(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Virtual memory allocation site, keeps track where the virtual memory is reserved.
|
||||
|
Loading…
x
Reference in New Issue
Block a user