8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "gc/shared/collectedHeap.hpp"
26 #include "gc/shared/collectorPolicy.hpp"
27 #include "gc/shared/gcLocker.hpp"
28 #include "memory/allocation.hpp"
29 #include "memory/binaryTreeDictionary.hpp"
30 #include "memory/filemap.hpp"
31 #include "memory/freeList.hpp"
32 #include "memory/metachunk.hpp"
33 #include "memory/metaspace.hpp"
34 #include "memory/metaspaceGCThresholdUpdater.hpp"
35 #include "memory/metaspaceShared.hpp"
36 #include "memory/metaspaceTracer.hpp"
37 #include "memory/resourceArea.hpp"
38 #include "memory/universe.hpp"
39 #include "runtime/atomic.inline.hpp"
40 #include "runtime/globals.hpp"
41 #include "runtime/init.hpp"
42 #include "runtime/java.hpp"
43 #include "runtime/mutex.hpp"
44 #include "runtime/orderAccess.inline.hpp"
45 #include "services/memTracker.hpp"
46 #include "services/memoryService.hpp"
47 #include "utilities/copy.hpp"
2739 }
2740
2741 size_t MetaspaceAux::free_chunks_total_bytes() {
2742 return free_chunks_total_words() * BytesPerWord;
2743 }
2744
2745 bool MetaspaceAux::has_chunk_free_list(Metaspace::MetadataType mdtype) {
2746 return Metaspace::get_chunk_manager(mdtype) != NULL;
2747 }
2748
2749 MetaspaceChunkFreeListSummary MetaspaceAux::chunk_free_list_summary(Metaspace::MetadataType mdtype) {
2750 if (!has_chunk_free_list(mdtype)) {
2751 return MetaspaceChunkFreeListSummary();
2752 }
2753
2754 const ChunkManager* cm = Metaspace::get_chunk_manager(mdtype);
2755 return cm->chunk_free_list_summary();
2756 }
2757
2758 void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
2759 gclog_or_tty->print(", [Metaspace:");
2760 if (PrintGCDetails && Verbose) {
2761 gclog_or_tty->print(" " SIZE_FORMAT
2762 "->" SIZE_FORMAT
2763 "(" SIZE_FORMAT ")",
2764 prev_metadata_used,
2765 used_bytes(),
2766 reserved_bytes());
2767 } else {
2768 gclog_or_tty->print(" " SIZE_FORMAT "K"
2769 "->" SIZE_FORMAT "K"
2770 "(" SIZE_FORMAT "K)",
2771 prev_metadata_used/K,
2772 used_bytes()/K,
2773 reserved_bytes()/K);
2774 }
2775
2776 gclog_or_tty->print("]");
2777 }
2778
2779 // This is printed when PrintGCDetails
2780 void MetaspaceAux::print_on(outputStream* out) {
2781 Metaspace::MetadataType nct = Metaspace::NonClassType;
2782
2783 out->print_cr(" Metaspace "
2784 "used " SIZE_FORMAT "K, "
2785 "capacity " SIZE_FORMAT "K, "
2786 "committed " SIZE_FORMAT "K, "
2787 "reserved " SIZE_FORMAT "K",
2788 used_bytes()/K,
2789 capacity_bytes()/K,
2790 committed_bytes()/K,
2791 reserved_bytes()/K);
2792
2793 if (Metaspace::using_class_space()) {
2794 Metaspace::MetadataType ct = Metaspace::ClassType;
2795 out->print_cr(" class space "
2796 "used " SIZE_FORMAT "K, "
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "gc/shared/collectedHeap.hpp"
26 #include "gc/shared/collectorPolicy.hpp"
27 #include "gc/shared/gcLocker.hpp"
28 #include "logging/log.hpp"
29 #include "memory/allocation.hpp"
30 #include "memory/binaryTreeDictionary.hpp"
31 #include "memory/filemap.hpp"
32 #include "memory/freeList.hpp"
33 #include "memory/metachunk.hpp"
34 #include "memory/metaspace.hpp"
35 #include "memory/metaspaceGCThresholdUpdater.hpp"
36 #include "memory/metaspaceShared.hpp"
37 #include "memory/metaspaceTracer.hpp"
38 #include "memory/resourceArea.hpp"
39 #include "memory/universe.hpp"
40 #include "runtime/atomic.inline.hpp"
41 #include "runtime/globals.hpp"
42 #include "runtime/init.hpp"
43 #include "runtime/java.hpp"
44 #include "runtime/mutex.hpp"
45 #include "runtime/orderAccess.inline.hpp"
46 #include "services/memTracker.hpp"
47 #include "services/memoryService.hpp"
48 #include "utilities/copy.hpp"
2740 }
2741
2742 size_t MetaspaceAux::free_chunks_total_bytes() {
2743 return free_chunks_total_words() * BytesPerWord;
2744 }
2745
2746 bool MetaspaceAux::has_chunk_free_list(Metaspace::MetadataType mdtype) {
2747 return Metaspace::get_chunk_manager(mdtype) != NULL;
2748 }
2749
2750 MetaspaceChunkFreeListSummary MetaspaceAux::chunk_free_list_summary(Metaspace::MetadataType mdtype) {
2751 if (!has_chunk_free_list(mdtype)) {
2752 return MetaspaceChunkFreeListSummary();
2753 }
2754
2755 const ChunkManager* cm = Metaspace::get_chunk_manager(mdtype);
2756 return cm->chunk_free_list_summary();
2757 }
2758
2759 void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
2760 log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "K->" SIZE_FORMAT "K(" SIZE_FORMAT "K)",
2761 prev_metadata_used/K, used_bytes()/K, reserved_bytes()/K);
2762 }
2763
2764 // This is printed when PrintGCDetails
2765 void MetaspaceAux::print_on(outputStream* out) {
2766 Metaspace::MetadataType nct = Metaspace::NonClassType;
2767
2768 out->print_cr(" Metaspace "
2769 "used " SIZE_FORMAT "K, "
2770 "capacity " SIZE_FORMAT "K, "
2771 "committed " SIZE_FORMAT "K, "
2772 "reserved " SIZE_FORMAT "K",
2773 used_bytes()/K,
2774 capacity_bytes()/K,
2775 committed_bytes()/K,
2776 reserved_bytes()/K);
2777
2778 if (Metaspace::using_class_space()) {
2779 Metaspace::MetadataType ct = Metaspace::ClassType;
2780 out->print_cr(" class space "
2781 "used " SIZE_FORMAT "K, "
|