1 /* |
1 /* |
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2017, 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. |
41 const char* scale = current_scale(); |
41 const char* scale = current_scale(); |
42 output()->print("reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s", |
42 output()->print("reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s", |
43 amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale); |
43 amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale); |
44 } |
44 } |
45 |
45 |
46 void MemReporterBase::print_malloc(size_t amount, size_t count) const { |
46 void MemReporterBase::print_malloc(size_t amount, size_t count, MEMFLAGS flag) const { |
47 const char* scale = current_scale(); |
47 const char* scale = current_scale(); |
48 outputStream* out = output(); |
48 outputStream* out = output(); |
49 out->print("(malloc=" SIZE_FORMAT "%s", |
49 if (flag != mtNone) { |
50 amount_in_current_scale(amount), scale); |
50 out->print("(malloc=" SIZE_FORMAT "%s type=%s", |
|
51 amount_in_current_scale(amount), scale, NMTUtil::flag_to_name(flag)); |
|
52 } else { |
|
53 out->print("(malloc=" SIZE_FORMAT "%s", |
|
54 amount_in_current_scale(amount), scale); |
|
55 } |
51 |
56 |
52 if (count > 0) { |
57 if (count > 0) { |
53 out->print(" #" SIZE_FORMAT "", count); |
58 out->print(" #" SIZE_FORMAT "", count); |
54 } |
59 } |
55 |
60 |
198 continue; |
203 continue; |
199 |
204 |
200 const NativeCallStack* stack = malloc_site->call_stack(); |
205 const NativeCallStack* stack = malloc_site->call_stack(); |
201 stack->print_on(out); |
206 stack->print_on(out); |
202 out->print("%29s", " "); |
207 out->print("%29s", " "); |
203 print_malloc(malloc_site->size(), malloc_site->count()); |
208 MEMFLAGS flag = malloc_site->flags(); |
|
209 assert((flag >= 0 && flag < (int)mt_number_of_types) && flag != mtNone, |
|
210 "Must have a valid memory type"); |
|
211 print_malloc(malloc_site->size(), malloc_site->count(),flag); |
204 out->print_cr("\n"); |
212 out->print_cr("\n"); |
205 } |
213 } |
206 } |
214 } |
207 |
215 |
208 void MemDetailReporter::report_virtual_memory_allocation_sites() { |
216 void MemDetailReporter::report_virtual_memory_allocation_sites() { |