< prev index next >

src/share/vm/services/memReporter.cpp

Print this page
rev 9024 : 8218558: NMT stack traces in output should show mt component for virtual memory allocations
Reviewed-by: shade, stuefe, coleenp

*** 1,7 **** /* ! * Copyright (c) 2012, 2017, 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. --- 1,7 ---- /* ! * Copyright (c) 2012, 2019, 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.
*** 203,213 **** continue; const NativeCallStack* stack = malloc_site->call_stack(); stack->print_on(out); out->print("%29s", " "); ! MEMFLAGS flag = malloc_site->flags(); assert((flag >= 0 && flag < (int)mt_number_of_types) && flag != mtNone, "Must have a valid memory type"); print_malloc(malloc_site->size(), malloc_site->count(),flag); out->print_cr("\n"); } --- 203,213 ---- continue; const NativeCallStack* stack = malloc_site->call_stack(); stack->print_on(out); out->print("%29s", " "); ! MEMFLAGS flag = malloc_site->flag(); assert((flag >= 0 && flag < (int)mt_number_of_types) && flag != mtNone, "Must have a valid memory type"); print_malloc(malloc_site->size(), malloc_site->count(),flag); out->print_cr("\n"); }
*** 229,238 **** --- 229,242 ---- const NativeCallStack* stack = virtual_memory_site->call_stack(); stack->print_on(out); out->print("%28s (", " "); print_total(virtual_memory_site->reserved(), virtual_memory_site->committed()); + MEMFLAGS flag = virtual_memory_site->flag(); + if (flag != mtNone) { + out->print(" Type=%s", NMTUtil::flag_to_name(flag)); + } out->print_cr(")\n"); } }
*** 560,587 **** } 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, 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->flags()); } void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early, const MallocSite* current) const { ! if (early->flags() != current->flags()) { // If malloc site type changed, treat it as deallocation of old type and // allocation of new type. old_malloc_site(early); new_malloc_site(current); } else { diff_malloc_site(current->call_stack(), current->size(), current->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, MEMFLAGS flags) const { --- 564,591 ---- } 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, malloc_site->flag()); } 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->flag()); } void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early, const MallocSite* current) const { ! if (early->flag() != current->flag()) { // If malloc site type changed, treat it as deallocation of old type and // allocation of new type. old_malloc_site(early); new_malloc_site(current); } else { diff_malloc_site(current->call_stack(), current->size(), current->count(), ! early->size(), early->count(), early->flag()); } } void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size, size_t current_count, size_t early_size, size_t early_count, MEMFLAGS flags) const {
*** 601,625 **** out->print_cr(")\n"); } void MemDetailDiffReporter::new_virtual_memory_site(const VirtualMemoryAllocationSite* site) const { ! diff_virtual_memory_site(site->call_stack(), site->reserved(), site->committed(), 0, 0); } void MemDetailDiffReporter::old_virtual_memory_site(const VirtualMemoryAllocationSite* site) const { ! diff_virtual_memory_site(site->call_stack(), 0, 0, site->reserved(), site->committed()); } void MemDetailDiffReporter::diff_virtual_memory_site(const VirtualMemoryAllocationSite* early, const VirtualMemoryAllocationSite* current) const { diff_virtual_memory_site(current->call_stack(), current->reserved(), current->committed(), ! early->reserved(), early->committed()); } void MemDetailDiffReporter::diff_virtual_memory_site(const NativeCallStack* stack, size_t current_reserved, ! size_t current_committed, size_t early_reserved, size_t early_committed) const { outputStream* out = output(); // no change if (diff_in_current_scale(current_reserved, early_reserved) == 0 && diff_in_current_scale(current_committed, early_committed) == 0) { --- 605,630 ---- out->print_cr(")\n"); } void MemDetailDiffReporter::new_virtual_memory_site(const VirtualMemoryAllocationSite* site) const { ! diff_virtual_memory_site(site->call_stack(), site->reserved(), site->committed(), 0, 0, site->flag()); } void MemDetailDiffReporter::old_virtual_memory_site(const VirtualMemoryAllocationSite* site) const { ! diff_virtual_memory_site(site->call_stack(), 0, 0, site->reserved(), site->committed(), site->flag()); } void MemDetailDiffReporter::diff_virtual_memory_site(const VirtualMemoryAllocationSite* early, const VirtualMemoryAllocationSite* current) const { + assert(early->flag() == current->flag(), "Should be the same"); diff_virtual_memory_site(current->call_stack(), current->reserved(), current->committed(), ! early->reserved(), early->committed(), current->flag()); } void MemDetailDiffReporter::diff_virtual_memory_site(const NativeCallStack* stack, size_t current_reserved, ! size_t current_committed, size_t early_reserved, size_t early_committed, MEMFLAGS flag) const { outputStream* out = output(); // no change if (diff_in_current_scale(current_reserved, early_reserved) == 0 && diff_in_current_scale(current_committed, early_committed) == 0) {
*** 629,636 **** --- 634,645 ---- stack->print_on(out); out->print("%28s (mmap: ", " "); print_virtual_memory_diff(current_reserved, current_committed, early_reserved, early_committed); + if (flag != mtNone) { + out->print(" Type=%s", NMTUtil::flag_to_name(flag)); + } + out->print_cr(")\n"); }
< prev index next >