src/hotspot/share/memory/metaspace/metaspaceReport.cpp
author stuefe
Tue, 26 Nov 2019 16:21:29 +0100
branchstuefe-new-metaspace-branch
changeset 59272 54750b448264
parent 59134 b67820888eb3
permissions -rw-r--r--
Metadatatype back to metaspace.hpp to reduce patch size
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     1
/*
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     2
 * Copyright (c) 2018, 2019 SAP and/or its affiliates.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     3
 * Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     5
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     8
 * published by the Free Software Foundation.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     9
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    14
 * accompanied this code).
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    15
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    19
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    22
 * questions.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    23
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    24
 */
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    25
#include "precompiled.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    26
#include "classfile/classLoaderData.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    27
#include "classfile/classLoaderDataGraph.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    28
#include "memory/metaspace/chunkHeaderPool.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    29
#include "memory/metaspace/chunkManager.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    30
#include "memory/metaspace/internStat.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    31
#include "memory/metaspace/metaspaceCommon.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    32
#include "memory/metaspace/metaspaceEnums.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    33
#include "memory/metaspace/metaspaceReport.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    34
#include "memory/metaspace/metaspaceStatistics.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    35
#include "memory/metaspace/printCLDMetaspaceInfoClosure.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    36
#include "memory/metaspace/runningCounters.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    37
#include "memory/metaspace/virtualSpaceList.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    38
#include "memory/metaspace.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    39
#include "runtime/os.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    40
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    41
namespace metaspace {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    42
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    43
static void print_vs(outputStream* out, size_t scale) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    44
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    45
  const size_t reserved_nc = RunningCounters::reserved_words_nonclass();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    46
  const size_t committed_nc = RunningCounters::committed_words_nonclass();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    47
  const int num_nodes_nc = VirtualSpaceList::vslist_nonclass()->num_nodes();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    48
  const size_t reserved_c = RunningCounters::reserved_words_class();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    49
  const size_t committed_c = RunningCounters::committed_words_class();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    50
  const int num_nodes_c = VirtualSpaceList::vslist_class()->num_nodes();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    51
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    52
  if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    53
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    54
    out->print("  Non-class space:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    55
    print_scaled_words(out, reserved_nc, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    56
    out->print(" reserved, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    57
    print_scaled_words_and_percentage(out, committed_nc, reserved_nc, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    58
    out->print(" committed, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    59
    out->print(" %d nodes.", num_nodes_nc);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    60
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    61
    out->print("      Class space:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    62
    print_scaled_words(out, reserved_c, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    63
    out->print(" reserved, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    64
    print_scaled_words_and_percentage(out, committed_c, reserved_c, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    65
    out->print(" committed, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    66
    out->print(" %d nodes.", num_nodes_c);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    67
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    68
    out->print("              Both:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    69
    print_scaled_words(out, reserved_c + reserved_nc, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    70
    out->print(" reserved, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    71
    print_scaled_words_and_percentage(out, committed_c + committed_nc, reserved_c + reserved_nc, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    72
    out->print(" committed. ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    73
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    74
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    75
  } else {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    76
    assert(committed_c == 0 && reserved_c == 0 && num_nodes_c == 0, "Sanity");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    77
    print_scaled_words(out, reserved_nc, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    78
    out->print(" reserved, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    79
    print_scaled_words_and_percentage(out, committed_nc, reserved_nc, scale, 7);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    80
    out->print(" committed, ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    81
    out->print(" %d nodes.", num_nodes_nc);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    82
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    83
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    84
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    85
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    86
static void print_settings(outputStream* out, size_t scale) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    87
  out->print("MaxMetaspaceSize: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    88
  if (MaxMetaspaceSize >= (max_uintx) - (2 * os::vm_page_size())) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    89
    // aka "very big". Default is max_uintx, but due to rounding in arg parsing the real
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    90
    // value is smaller.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    91
    out->print("unlimited");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    92
  } else {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    93
    print_human_readable_size(out, MaxMetaspaceSize, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    94
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    95
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    96
  if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    97
    out->print("CompressedClassSpaceSize: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    98
    print_human_readable_size(out, CompressedClassSpaceSize, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    99
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   100
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   101
  out->print("InitialBootClassLoaderMetaspaceSize: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   102
  print_human_readable_size(out, InitialBootClassLoaderMetaspaceSize, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   103
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   104
  Settings::print_on(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   105
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   106
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   107
// This will print out a basic metaspace usage report but
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   108
// unlike print_report() is guaranteed not to lock or to walk the CLDG.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   109
void MetaspaceReporter::print_basic_report(outputStream* out, size_t scale) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   110
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   111
  if (!Metaspace::initialized()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   112
    out->print_cr("Metaspace not yet initialized.");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   113
    return;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   114
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   115
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   116
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   117
  out->print_cr("Usage:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   118
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   119
  if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   120
    out->print("  Non-class:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   121
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   122
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   123
  // Note: since we want to purely rely on counters, without any locking or walking the CLDG,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   124
  // for Usage stats (statistics over in-use chunks) all we can print is the
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   125
  // used words. We cannot print committed areas, or free/waste areas, of in-use chunks require
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   126
  // walking.
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 59134
diff changeset
   127
  const size_t used_nc = MetaspaceUtils::used_words(Metaspace::NonClassType);
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   128
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   129
  print_scaled_words(out, used_nc, scale, 5);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   130
  out->print(" used.");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   131
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   132
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   133
  if (Metaspace::using_class_space()) {
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 59134
diff changeset
   134
    const size_t used_c = MetaspaceUtils::used_words(Metaspace::ClassType);
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   135
    out->print("      Class:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   136
    print_scaled_words(out, used_c, scale, 5);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   137
    out->print(" used.");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   138
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   139
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   140
    out->print("       Both:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   141
    const size_t used = used_nc + used_c;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   142
    print_scaled_words(out, used, scale, 5);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   143
    out->print(" used.");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   144
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   145
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   146
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   147
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   148
  out->print_cr("Virtual space:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   149
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   150
  print_vs(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   151
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   152
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   153
  out->print_cr("Chunk freelists:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   154
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   155
  if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   156
    out->print("   Non-Class:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   157
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   158
  print_scaled_words(out, ChunkManager::chunkmanager_nonclass()->total_word_size(), scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   159
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   160
  if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   161
    out->print("       Class:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   162
    print_scaled_words(out, ChunkManager::chunkmanager_class()->total_word_size(), scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   163
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   164
    out->print("        Both:  ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   165
    print_scaled_words(out, ChunkManager::chunkmanager_nonclass()->total_word_size() +
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   166
                            ChunkManager::chunkmanager_class()->total_word_size(), scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   167
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   168
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   169
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   170
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   171
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   172
  // Print basic settings
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   173
  print_settings(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   174
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   175
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   176
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   177
#ifdef ASSERT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   178
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   179
  out->print_cr("Internal statistics:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   180
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   181
  InternalStats::print_on(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   182
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   183
#endif
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   184
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   185
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   186
void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   187
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   188
  if (!Metaspace::initialized()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   189
    out->print_cr("Metaspace not yet initialized.");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   190
    return;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   191
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   192
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   193
  const bool print_loaders = (flags & rf_show_loaders) > 0;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   194
  const bool print_classes = (flags & rf_show_classes) > 0;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   195
  const bool print_by_chunktype = (flags & rf_break_down_by_chunktype) > 0;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   196
  const bool print_by_spacetype = (flags & rf_break_down_by_spacetype) > 0;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   197
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   198
  // Some report options require walking the class loader data graph.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   199
  metaspace::PrintCLDMetaspaceInfoClosure cl(out, scale, print_loaders, print_classes, print_by_chunktype);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   200
  if (print_loaders) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   201
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   202
    out->print_cr("Usage per loader:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   203
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   204
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   205
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   206
  ClassLoaderDataGraph::loaded_cld_do(&cl); // collect data and optionally print
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   207
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   208
  // Print totals, broken up by space type.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   209
  if (print_by_spacetype) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   210
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   211
    out->print_cr("Usage per space type:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   212
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   213
    for (int space_type = (int)metaspace::ZeroMetaspaceType;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   214
         space_type < (int)metaspace::MetaspaceTypeCount; space_type ++)
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   215
    {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   216
      uintx num_loaders = cl._num_loaders_by_spacetype[space_type];
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   217
      uintx num_classes = cl._num_classes_by_spacetype[space_type];
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   218
      out->print("%s - " UINTX_FORMAT " %s",
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   219
        describe_spacetype((MetaspaceType)space_type),
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   220
        num_loaders, loaders_plural(num_loaders));
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   221
      if (num_classes > 0) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   222
        out->print(", ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   223
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   224
        print_number_of_classes(out, num_classes, cl._num_classes_shared_by_spacetype[space_type]);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   225
        out->print(":");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   226
        cl._stats_by_spacetype[space_type].print_on(out, scale, print_by_chunktype);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   227
      } else {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   228
        out->print(".");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   229
        out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   230
      }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   231
      out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   232
    }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   233
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   234
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   235
  // Print totals for in-use data:
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   236
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   237
  {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   238
    uintx num_loaders = cl._num_loaders;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   239
    out->print("Total Usage - " UINTX_FORMAT " %s, ",
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   240
      num_loaders, loaders_plural(num_loaders));
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   241
    print_number_of_classes(out, cl._num_classes, cl._num_classes_shared);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   242
    out->print(":");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   243
    cl._stats_total.print_on(out, scale, print_by_chunktype);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   244
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   245
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   246
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   247
  /////////////////////////////////////////////////
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   248
  // -- Print Virtual space.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   249
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   250
  out->print_cr("Virtual space:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   251
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   252
  print_vs(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   253
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   254
  // -- Print VirtualSpaceList details.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   255
  if ((flags & rf_show_vslist) > 0) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   256
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   257
    out->print_cr("Virtual space list%s:", Metaspace::using_class_space() ? "s" : "");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   258
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   259
    if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   260
      out->print_cr("   Non-Class:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   261
    }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   262
    VirtualSpaceList::vslist_nonclass()->print_on(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   263
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   264
    if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   265
      out->print_cr("       Class:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   266
      VirtualSpaceList::vslist_class()->print_on(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   267
      out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   268
    }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   269
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   270
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   271
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   272
  // -- Print VirtualSpaceList map.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   273
/* Deactivated for now.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   274
  if ((flags & rf_show_vsmap) > 0) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   275
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   276
    out->print_cr("Virtual space map:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   277
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   278
    if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   279
      out->print_cr("   Non-Class:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   280
    }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   281
    Metaspace::space_list()->print_map(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   282
    if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   283
      out->print_cr("       Class:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   284
      Metaspace::class_space_list()->print_map(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   285
    }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   286
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   287
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   288
*/
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   289
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   290
  //////////// Freelists (ChunkManager) section ///////////////////////////
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   291
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   292
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   293
  out->print_cr("Chunk freelist%s:", Metaspace::using_class_space() ? "s" : "");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   294
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   295
  cm_stats_t non_class_cm_stat;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   296
  cm_stats_t class_cm_stat;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   297
  cm_stats_t total_cm_stat;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   298
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   299
  ChunkManager::chunkmanager_nonclass()->add_to_statistics(&non_class_cm_stat);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   300
  if (Metaspace::using_class_space()) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   301
    ChunkManager::chunkmanager_nonclass()->add_to_statistics(&non_class_cm_stat);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   302
    ChunkManager::chunkmanager_class()->add_to_statistics(&class_cm_stat);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   303
    total_cm_stat.add(non_class_cm_stat);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   304
    total_cm_stat.add(class_cm_stat);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   305
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   306
    out->print_cr("   Non-Class:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   307
    non_class_cm_stat.print_on(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   308
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   309
    out->print_cr("       Class:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   310
    class_cm_stat.print_on(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   311
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   312
    out->print_cr("        Both:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   313
    total_cm_stat.print_on(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   314
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   315
  } else {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   316
    ChunkManager::chunkmanager_nonclass()->add_to_statistics(&non_class_cm_stat);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   317
    non_class_cm_stat.print_on(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   318
    out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   319
  }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   320
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   321
  //////////// Waste section ///////////////////////////
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   322
  // As a convenience, print a summary of common waste.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   323
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   324
  out->print("Waste (unused committed space):");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   325
  // For all wastages, print percentages from total. As total use the total size of memory committed for metaspace.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   326
  const size_t committed_words = RunningCounters::committed_words();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   327
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   328
  out->print("(percentages refer to total committed size ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   329
  print_scaled_words(out, committed_words, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   330
  out->print_cr("):");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   331
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   332
  // Print waste for in-use chunks.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   333
  in_use_chunk_stats_t ucs_nonclass = cl._stats_total.sm_stats_nonclass.totals();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   334
  in_use_chunk_stats_t ucs_class = cl._stats_total.sm_stats_class.totals();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   335
  const size_t waste_in_chunks_in_use = ucs_nonclass.waste_words + ucs_class.waste_words;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   336
  const size_t free_in_chunks_in_use = ucs_nonclass.free_words + ucs_class.free_words;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   337
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   338
  out->print("        Waste in chunks in use: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   339
  print_scaled_words_and_percentage(out, waste_in_chunks_in_use, committed_words, scale, 6);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   340
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   341
  out->print("        Free in chunks in use: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   342
  print_scaled_words_and_percentage(out, free_in_chunks_in_use, committed_words, scale, 6);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   343
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   344
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   345
  // Print waste in free chunks.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   346
  const size_t committed_in_free_chunks = total_cm_stat.total_committed_word_size();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   347
  out->print("                In free chunks: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   348
  print_scaled_words_and_percentage(out, committed_in_free_chunks, committed_words, scale, 6);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   349
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   350
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   351
  // Print waste in deallocated blocks.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   352
  const uintx free_blocks_num =
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   353
      cl._stats_total.sm_stats_nonclass.free_blocks_num +
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   354
      cl._stats_total.sm_stats_class.free_blocks_num;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   355
  const size_t free_blocks_cap_words =
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   356
      cl._stats_total.sm_stats_nonclass.free_blocks_word_size +
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   357
      cl._stats_total.sm_stats_class.free_blocks_word_size;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   358
  out->print("Deallocated from chunks in use: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   359
  print_scaled_words_and_percentage(out, free_blocks_cap_words, committed_words, scale, 6);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   360
  out->print(" (" UINTX_FORMAT " blocks)", free_blocks_num);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   361
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   362
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   363
  // Print total waste.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   364
  const size_t total_waste =
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   365
      waste_in_chunks_in_use +
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   366
      free_in_chunks_in_use +
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   367
      committed_in_free_chunks +
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   368
      free_blocks_cap_words;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   369
  out->print("                       -total-: ");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   370
  print_scaled_words_and_percentage(out, total_waste, committed_words, scale, 6);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   371
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   372
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   373
  // Also print chunk header pool size.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   374
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   375
  out->print("chunk header pool: %u items, ", ChunkHeaderPool::pool().used());
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   376
  print_scaled_words(out, ChunkHeaderPool::pool().memory_footprint_words(), scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   377
  out->print(".");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   378
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   379
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   380
  // Print internal statistics
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   381
#ifdef ASSERT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   382
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   383
  out->print_cr("Internal statistics:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   384
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   385
  InternalStats::print_on(out);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   386
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   387
#endif
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   388
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   389
  // Print some interesting settings
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   390
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   391
  out->print_cr("Settings:");
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   392
  print_settings(out, scale);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   393
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   394
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   395
  out->cr();
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   396
59134
b67820888eb3 Verify metaspace when printing VM.metaspace
stuefe
parents: 58063
diff changeset
   397
  DEBUG_ONLY(MetaspaceUtils::verify(true);)
b67820888eb3 Verify metaspace when printing VM.metaspace
stuefe
parents: 58063
diff changeset
   398
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   399
} // MetaspaceUtils::print_report()
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   400
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   401
} // namespace metaspace
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   402