1 /* 2 * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #include "precompiled.hpp" 25 26 #include "gc_implementation/shenandoah/shenandoahAllocTracker.hpp" 27 #include "utilities/ostream.hpp" 28 29 void ShenandoahAllocTracker::print_on(outputStream* out) const { 30 out->print_cr("ALLOCATION TRACING"); 31 out->print_cr(" These are the slow-path allocations, including TLAB/GCLAB refills, and out-of-TLAB allocations."); 32 out->print_cr(" In-TLAB/GCLAB allocations happen orders of magnitude more frequently, and without delays."); 33 out->cr(); 34 35 out->print("%18s", ""); 36 for (size_t t = 0; t < ShenandoahHeap::_ALLOC_LIMIT; t++) { 37 out->print("%12s", ShenandoahHeap::alloc_type_to_string(ShenandoahHeap::AllocType(t))); 38 } 39 out->cr(); 40 41 out->print_cr("Counts:"); 42 out->print("%18s", "#"); 43 for (size_t t = 0; t < ShenandoahHeap::_ALLOC_LIMIT; t++) { 44 out->print(SIZE_FORMAT_W(12), _alloc_size[t].num()); 45 } 46 out->cr(); 47 out->cr(); 48 49 // Figure out max and min levels 50 int lat_min_level = +1000; 51 int lat_max_level = -1000; 52 int size_min_level = +1000; 53 int size_max_level = -1000; 54 for (size_t t = 0; t < ShenandoahHeap::_ALLOC_LIMIT; t++) { 55 lat_min_level = MIN2(lat_min_level, _alloc_latency[t].min_level()); 56 lat_max_level = MAX2(lat_max_level, _alloc_latency[t].max_level()); 57 size_min_level = MIN2(size_min_level, _alloc_size[t].min_level()); 58 size_max_level = MAX2(size_max_level, _alloc_size[t].max_level()); 59 } 60 61 out->print_cr("Latencies (in microseconds):"); 62 for (int c = lat_min_level; c <= lat_max_level; c++) { 63 out->print("%7d - %7d:", (c == 0) ? 0 : 1 << (c - 1), 1 << c); 64 for (size_t t = 0; t < ShenandoahHeap::_ALLOC_LIMIT; t++) { 65 out->print(SIZE_FORMAT_W(12), _alloc_latency[t].level(c)); 66 } 67 out->cr(); 68 } 69 out->cr(); 70 71 out->print_cr("Sizes (in bytes):"); 72 for (int c = size_min_level; c <= size_max_level; c++) { 73 out->print("%7d - %7d:", (c == 0) ? 0 : 1 << (c - 1), 1 << c); 74 for (size_t t = 0; t < ShenandoahHeap::_ALLOC_LIMIT; t++) { 75 out->print(SIZE_FORMAT_W(12), _alloc_size[t].level(c)); 76 } 77 out->cr(); 78 } 79 out->cr(); 80 }