src/share/vm/services/memReporter.cpp

changeset 9806
758c07667682
parent 9637
eef07cd490d4
parent 9778
bf6ea7319424
equal deleted inserted replaced
9762:c97db0855565 9806:758c07667682
1 /* 1 /*
2 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
203 continue; 203 continue;
204 204
205 const NativeCallStack* stack = malloc_site->call_stack(); 205 const NativeCallStack* stack = malloc_site->call_stack();
206 stack->print_on(out); 206 stack->print_on(out);
207 out->print("%29s", " "); 207 out->print("%29s", " ");
208 MEMFLAGS flag = malloc_site->flags(); 208 MEMFLAGS flag = malloc_site->flag();
209 assert((flag >= 0 && flag < (int)mt_number_of_types) && flag != mtNone, 209 assert((flag >= 0 && flag < (int)mt_number_of_types) && flag != mtNone,
210 "Must have a valid memory type"); 210 "Must have a valid memory type");
211 print_malloc(malloc_site->size(), malloc_site->count(),flag); 211 print_malloc(malloc_site->size(), malloc_site->count(),flag);
212 out->print_cr("\n"); 212 out->print_cr("\n");
213 } 213 }
229 229
230 const NativeCallStack* stack = virtual_memory_site->call_stack(); 230 const NativeCallStack* stack = virtual_memory_site->call_stack();
231 stack->print_on(out); 231 stack->print_on(out);
232 out->print("%28s (", " "); 232 out->print("%28s (", " ");
233 print_total(virtual_memory_site->reserved(), virtual_memory_site->committed()); 233 print_total(virtual_memory_site->reserved(), virtual_memory_site->committed());
234 MEMFLAGS flag = virtual_memory_site->flag();
235 if (flag != mtNone) {
236 out->print(" Type=%s", NMTUtil::flag_to_name(flag));
237 }
234 out->print_cr(")\n"); 238 out->print_cr(")\n");
235 } 239 }
236 } 240 }
237 241
238 242
560 } 564 }
561 565
562 566
563 void MemDetailDiffReporter::new_malloc_site(const MallocSite* malloc_site) const { 567 void MemDetailDiffReporter::new_malloc_site(const MallocSite* malloc_site) const {
564 diff_malloc_site(malloc_site->call_stack(), malloc_site->size(), malloc_site->count(), 568 diff_malloc_site(malloc_site->call_stack(), malloc_site->size(), malloc_site->count(),
565 0, 0, malloc_site->flags()); 569 0, 0, malloc_site->flag());
566 } 570 }
567 571
568 void MemDetailDiffReporter::old_malloc_site(const MallocSite* malloc_site) const { 572 void MemDetailDiffReporter::old_malloc_site(const MallocSite* malloc_site) const {
569 diff_malloc_site(malloc_site->call_stack(), 0, 0, malloc_site->size(), 573 diff_malloc_site(malloc_site->call_stack(), 0, 0, malloc_site->size(),
570 malloc_site->count(), malloc_site->flags()); 574 malloc_site->count(), malloc_site->flag());
571 } 575 }
572 576
573 void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early, 577 void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early,
574 const MallocSite* current) const { 578 const MallocSite* current) const {
575 if (early->flags() != current->flags()) { 579 if (early->flag() != current->flag()) {
576 // If malloc site type changed, treat it as deallocation of old type and 580 // If malloc site type changed, treat it as deallocation of old type and
577 // allocation of new type. 581 // allocation of new type.
578 old_malloc_site(early); 582 old_malloc_site(early);
579 new_malloc_site(current); 583 new_malloc_site(current);
580 } else { 584 } else {
581 diff_malloc_site(current->call_stack(), current->size(), current->count(), 585 diff_malloc_site(current->call_stack(), current->size(), current->count(),
582 early->size(), early->count(), early->flags()); 586 early->size(), early->count(), early->flag());
583 } 587 }
584 } 588 }
585 589
586 void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size, 590 void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size,
587 size_t current_count, size_t early_size, size_t early_count, MEMFLAGS flags) const { 591 size_t current_count, size_t early_size, size_t early_count, MEMFLAGS flags) const {
601 out->print_cr(")\n"); 605 out->print_cr(")\n");
602 } 606 }
603 607
604 608
605 void MemDetailDiffReporter::new_virtual_memory_site(const VirtualMemoryAllocationSite* site) const { 609 void MemDetailDiffReporter::new_virtual_memory_site(const VirtualMemoryAllocationSite* site) const {
606 diff_virtual_memory_site(site->call_stack(), site->reserved(), site->committed(), 0, 0); 610 diff_virtual_memory_site(site->call_stack(), site->reserved(), site->committed(), 0, 0, site->flag());
607 } 611 }
608 612
609 void MemDetailDiffReporter::old_virtual_memory_site(const VirtualMemoryAllocationSite* site) const { 613 void MemDetailDiffReporter::old_virtual_memory_site(const VirtualMemoryAllocationSite* site) const {
610 diff_virtual_memory_site(site->call_stack(), 0, 0, site->reserved(), site->committed()); 614 diff_virtual_memory_site(site->call_stack(), 0, 0, site->reserved(), site->committed(), site->flag());
611 } 615 }
612 616
613 void MemDetailDiffReporter::diff_virtual_memory_site(const VirtualMemoryAllocationSite* early, 617 void MemDetailDiffReporter::diff_virtual_memory_site(const VirtualMemoryAllocationSite* early,
614 const VirtualMemoryAllocationSite* current) const { 618 const VirtualMemoryAllocationSite* current) const {
619 assert(early->flag() == current->flag(), "Should be the same");
615 diff_virtual_memory_site(current->call_stack(), current->reserved(), current->committed(), 620 diff_virtual_memory_site(current->call_stack(), current->reserved(), current->committed(),
616 early->reserved(), early->committed()); 621 early->reserved(), early->committed(), current->flag());
617 } 622 }
618 623
619 void MemDetailDiffReporter::diff_virtual_memory_site(const NativeCallStack* stack, size_t current_reserved, 624 void MemDetailDiffReporter::diff_virtual_memory_site(const NativeCallStack* stack, size_t current_reserved,
620 size_t current_committed, size_t early_reserved, size_t early_committed) const { 625 size_t current_committed, size_t early_reserved, size_t early_committed, MEMFLAGS flag) const {
621 outputStream* out = output(); 626 outputStream* out = output();
622 627
623 // no change 628 // no change
624 if (diff_in_current_scale(current_reserved, early_reserved) == 0 && 629 if (diff_in_current_scale(current_reserved, early_reserved) == 0 &&
625 diff_in_current_scale(current_committed, early_committed) == 0) { 630 diff_in_current_scale(current_committed, early_committed) == 0) {
629 stack->print_on(out); 634 stack->print_on(out);
630 out->print("%28s (mmap: ", " "); 635 out->print("%28s (mmap: ", " ");
631 print_virtual_memory_diff(current_reserved, current_committed, 636 print_virtual_memory_diff(current_reserved, current_committed,
632 early_reserved, early_committed); 637 early_reserved, early_committed);
633 638
639 if (flag != mtNone) {
640 out->print(" Type=%s", NMTUtil::flag_to_name(flag));
641 }
642
634 out->print_cr(")\n"); 643 out->print_cr(")\n");
635 } 644 }
636 645

mercurial