--- a/hotspot/src/share/vm/services/memReporter.cpp Sat Jul 22 10:03:15 2017 +0200
+++ b/hotspot/src/share/vm/services/memReporter.cpp Mon Jul 24 15:19:46 2017 -0400
@@ -312,11 +312,16 @@
}
void MemSummaryDiffReporter::print_malloc_diff(size_t current_amount, size_t current_count,
- size_t early_amount, size_t early_count) const {
+ size_t early_amount, size_t early_count, MEMFLAGS flags) const {
const char* scale = current_scale();
outputStream* out = output();
out->print("malloc=" SIZE_FORMAT "%s", amount_in_current_scale(current_amount), scale);
+ // Report type only if it is valid
+ if (flags != mtNone) {
+ out->print(" type=%s", NMTUtil::flag_to_name(flags));
+ }
+
long amount_diff = diff_in_current_scale(current_amount, early_amount);
if (amount_diff != 0) {
out->print(" %+ld%s", amount_diff, scale);
@@ -445,7 +450,7 @@
diff_in_current_scale(current_malloc_amount, early_malloc_amount) != 0) {
out->print("%28s(", " ");
print_malloc_diff(current_malloc_amount, (flag == mtChunk) ? 0 : current_malloc->malloc_count(),
- early_malloc_amount, early_malloc->malloc_count());
+ early_malloc_amount, early_malloc->malloc_count(), mtNone);
out->print_cr(")");
}
@@ -493,8 +498,8 @@
}
void MemDetailDiffReporter::diff_malloc_sites() const {
- MallocSiteIterator early_itr = _early_baseline.malloc_sites(MemBaseline::by_site);
- MallocSiteIterator current_itr = _current_baseline.malloc_sites(MemBaseline::by_site);
+ MallocSiteIterator early_itr = _early_baseline.malloc_sites(MemBaseline::by_site_and_type);
+ MallocSiteIterator current_itr = _current_baseline.malloc_sites(MemBaseline::by_site_and_type);
const MallocSite* early_site = early_itr.next();
const MallocSite* current_site = current_itr.next();
@@ -557,22 +562,23 @@
void MemDetailDiffReporter::new_malloc_site(const MallocSite* malloc_site) const {
diff_malloc_site(malloc_site->call_stack(), malloc_site->size(), malloc_site->count(),
- 0, 0);
+ 0, 0, malloc_site->flags());
}
void MemDetailDiffReporter::old_malloc_site(const MallocSite* malloc_site) const {
diff_malloc_site(malloc_site->call_stack(), 0, 0, malloc_site->size(),
- malloc_site->count());
+ malloc_site->count(), malloc_site->flags());
}
void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early,
const MallocSite* current) const {
+ assert(early->flags() == current->flags(), "Must be the same memory type");
diff_malloc_site(current->call_stack(), current->size(), current->count(),
- early->size(), early->count());
+ early->size(), early->count(), early->flags());
}
void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size,
- size_t current_count, size_t early_size, size_t early_count) const {
+ size_t current_count, size_t early_size, size_t early_count, MEMFLAGS flags) const {
outputStream* out = output();
assert(stack != NULL, "NULL stack");
@@ -584,7 +590,7 @@
stack->print_on(out);
out->print("%28s (", " ");
print_malloc_diff(current_size, current_count,
- early_size, early_count);
+ early_size, early_count, flags);
out->print_cr(")\n");
}