Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8261238: NMT should not limit baselining by size threshold #2428

Open
Open
Changes from 2 commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -96,6 +96,7 @@ void MemReporterBase::print_virtual_memory_region(const char* type, address base


void MemSummaryReporter::report() {
const char* scale = current_scale();
outputStream* out = output();
size_t total_reserved_amount = _malloc_snapshot->total() +
_vm_snapshot->total_reserved();
@@ -104,12 +105,6 @@ void MemSummaryReporter::report() {

// Overall total
out->print_cr("\nNative Memory Tracking:\n");

if (scale() > 1) {
out->print_cr("(Omitting categories weighting less than 1%s)", current_scale());
out->cr();
}

out->print("Total: ");
print_total(total_reserved_amount, total_committed_amount);
out->print("\n");
@@ -247,35 +242,22 @@ void MemDetailReporter::report_detail() {
outputStream* out = output();
out->print_cr("Details:\n");

int num_omitted =
report_malloc_sites() +
report_virtual_memory_allocation_sites();
if (num_omitted > 0) {
assert(scale() > 1, "sanity");
out->print_cr("(%d call sites weighting less than 1%s each omitted.)",
num_omitted, current_scale());
out->cr();
}
report_malloc_sites();
report_virtual_memory_allocation_sites();
}

int MemDetailReporter::report_malloc_sites() {
void MemDetailReporter::report_malloc_sites() {
MallocSiteIterator malloc_itr = _baseline.malloc_sites(MemBaseline::by_size);
if (malloc_itr.is_empty()) return 0;
if (malloc_itr.is_empty()) return;

outputStream* out = output();

const MallocSite* malloc_site;
int num_omitted = 0;
while ((malloc_site = malloc_itr.next()) != NULL) {
// Don't report free sites; does not count toward omitted count.
if (malloc_site->size() == 0) {
continue;
}
// Don't report if site has allocated less than one unit of whatever our scale is
if (scale() > 1 && amount_in_current_scale(malloc_site->size()) == 0) {
num_omitted ++;
// Don't report if size is too small
if (amount_in_current_scale(malloc_site->size()) == 0)
continue;
}

const NativeCallStack* stack = malloc_site->call_stack();
stack->print_on(out);
out->print("%29s", " ");
@@ -285,28 +267,22 @@ int MemDetailReporter::report_malloc_sites() {
print_malloc(malloc_site->size(), malloc_site->count(),flag);
out->print_cr("\n");
}
return num_omitted;
}

int MemDetailReporter::report_virtual_memory_allocation_sites() {
void MemDetailReporter::report_virtual_memory_allocation_sites() {
VirtualMemorySiteIterator virtual_memory_itr =
_baseline.virtual_memory_sites(MemBaseline::by_size);

if (virtual_memory_itr.is_empty()) return 0;
if (virtual_memory_itr.is_empty()) return;

outputStream* out = output();
const VirtualMemoryAllocationSite* virtual_memory_site;
int num_omitted = 0;

while ((virtual_memory_site = virtual_memory_itr.next()) != NULL) {
// Don't report free sites; does not count toward omitted count.
if (virtual_memory_site->reserved() == 0) {
continue;
}
// Don't report if site has reserved less than one unit of whatever our scale is
if (scale() > 1 && amount_in_current_scale(virtual_memory_site->reserved()) == 0) {
num_omitted ++;
// Don't report if size is too small
if (amount_in_current_scale(virtual_memory_site->reserved()) == 0)
continue;
}

const NativeCallStack* stack = virtual_memory_site->call_stack();
stack->print_on(out);
out->print("%28s (", " ");
@@ -317,7 +293,6 @@ int MemDetailReporter::report_virtual_memory_allocation_sites() {
}
out->print_cr(")\n");
}
return num_omitted;
}


@@ -383,14 +358,10 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion*
}

void MemSummaryDiffReporter::report_diff() {
const char* scale = current_scale();
outputStream* out = output();
out->print_cr("\nNative Memory Tracking:\n");

if (scale() > 1) {
out->print_cr("(Omitting categories weighting less than 1%s)", current_scale());
out->cr();
}

// Overall diff
out->print("Total: ");
print_virtual_memory_diff(_current_baseline.total_reserved_memory(),
@@ -56,9 +56,6 @@ class MemReporterBase : public StackObj {
return _output;
}
// Current reporting scale
size_t scale() const {
return _scale;
}
inline const char* current_scale() const {
return NMTUtil::scale_name(_scale);
}
@@ -147,10 +144,10 @@ class MemDetailReporter : public MemSummaryReporter {
void report_detail();
// Report virtual memory map
void report_virtual_memory_map();
// Report malloc allocation sites; returns number of omitted sites.
int report_malloc_sites();
// Report virtual memory reservation sites; returns number of omitted sites.
int report_virtual_memory_allocation_sites();
// Report malloc allocation sites
void report_malloc_sites();
// Report virtual memory reservation sites
void report_virtual_memory_allocation_sites();

// Report a virtual memory region
void report_virtual_memory_region(const ReservedMemoryRegion* rgn);
ProTip! Use n and p to navigate between commits in a pull request.