src/share/vm/memory/metaspaceShared.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/share/vm/memory/metaspaceShared.cpp
src/share/vm/memory/metaspaceShared.cpp
Print this page
*** 38,47 ****
--- 38,48 ----
#include "runtime/signature.hpp"
#include "runtime/vm_operations.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/hashtable.inline.hpp"
+ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
int MetaspaceShared::_max_alignment = 0;
ReservedSpace* MetaspaceShared::_shared_rs = NULL;
*** 335,351 ****
int all_ro_count = 0;
int all_ro_bytes = 0;
int all_rw_count = 0;
int all_rw_bytes = 0;
! const char *fmt = "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f";
const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %";
tty->print_cr("Detailed metadata info (rw includes md and mc):");
! tty->print_cr(hdr);
! tty->print_cr(sep);
for (int type = 0; type < int(_number_of_types); type ++) {
const char *name = type_name((Type)type);
int ro_count = _counts[RO][type];
int ro_bytes = _bytes [RO][type];
int rw_count = _counts[RW][type];
--- 336,353 ----
int all_ro_count = 0;
int all_ro_bytes = 0;
int all_rw_count = 0;
int all_rw_bytes = 0;
! // To make fmt_stats be a syntactic constant (for format warnings), use #define.
! #define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"
const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %";
tty->print_cr("Detailed metadata info (rw includes md and mc):");
! tty->print_raw_cr(hdr);
! tty->print_raw_cr(sep);
for (int type = 0; type < int(_number_of_types); type ++) {
const char *name = type_name((Type)type);
int ro_count = _counts[RO][type];
int ro_bytes = _bytes [RO][type];
int rw_count = _counts[RW][type];
*** 355,365 ****
double ro_perc = 100.0 * double(ro_bytes) / double(ro_all);
double rw_perc = 100.0 * double(rw_bytes) / double(rw_all);
double perc = 100.0 * double(bytes) / double(ro_all + rw_all);
! tty->print_cr(fmt, name,
ro_count, ro_bytes, ro_perc,
rw_count, rw_bytes, rw_perc,
count, bytes, perc);
all_ro_count += ro_count;
--- 357,367 ----
double ro_perc = 100.0 * double(ro_bytes) / double(ro_all);
double rw_perc = 100.0 * double(rw_bytes) / double(rw_all);
double perc = 100.0 * double(bytes) / double(ro_all + rw_all);
! tty->print_cr(fmt_stats, name,
ro_count, ro_bytes, ro_perc,
rw_count, rw_bytes, rw_perc,
count, bytes, perc);
all_ro_count += ro_count;
*** 373,390 ****
double all_ro_perc = 100.0 * double(all_ro_bytes) / double(ro_all);
double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all);
double all_perc = 100.0 * double(all_bytes) / double(ro_all + rw_all);
! tty->print_cr(sep);
! tty->print_cr(fmt, "Total",
all_ro_count, all_ro_bytes, all_ro_perc,
all_rw_count, all_rw_bytes, all_rw_perc,
all_count, all_bytes, all_perc);
assert(all_ro_bytes == ro_all, "everything should have been counted");
assert(all_rw_bytes == rw_all, "everything should have been counted");
}
// Populate the shared space.
class VM_PopulateDumpSharedSpace: public VM_Operation {
--- 375,393 ----
double all_ro_perc = 100.0 * double(all_ro_bytes) / double(ro_all);
double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all);
double all_perc = 100.0 * double(all_bytes) / double(ro_all + rw_all);
! tty->print_raw_cr(sep);
! tty->print_cr(fmt_stats, "Total",
all_ro_count, all_ro_bytes, all_ro_perc,
all_rw_count, all_rw_bytes, all_rw_perc,
all_count, all_bytes, all_perc);
assert(all_ro_bytes == ro_all, "everything should have been counted");
assert(all_rw_bytes == rw_all, "everything should have been counted");
+ #undef fmt_stats
}
// Populate the shared space.
class VM_PopulateDumpSharedSpace: public VM_Operation {
*** 512,522 ****
WriteClosure wc(md_top, md_end);
MetaspaceShared::serialize(&wc);
md_top = wc.get_top();
// Print shared spaces all the time
! const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT;
Metaspace* ro_space = _loader_data->ro_metaspace();
Metaspace* rw_space = _loader_data->rw_metaspace();
// Allocated size of each space (may not be all occupied)
const size_t ro_alloced = ro_space->capacity_bytes_slow(Metaspace::NonClassType);
--- 515,526 ----
WriteClosure wc(md_top, md_end);
MetaspaceShared::serialize(&wc);
md_top = wc.get_top();
// Print shared spaces all the time
! // To make fmt_space be a syntactic constant (for format warnings), use #define.
! #define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT
Metaspace* ro_space = _loader_data->ro_metaspace();
Metaspace* rw_space = _loader_data->rw_metaspace();
// Allocated size of each space (may not be all occupied)
const size_t ro_alloced = ro_space->capacity_bytes_slow(Metaspace::NonClassType);
*** 543,556 ****
const double rw_u_perc = rw_bytes / double(rw_alloced) * 100.0;
const double md_u_perc = md_bytes / double(md_alloced) * 100.0;
const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
! tty->print_cr(fmt, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
! tty->print_cr(fmt, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
! tty->print_cr(fmt, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
! tty->print_cr(fmt, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
tty->print_cr("total : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]",
total_bytes, total_alloced, total_u_perc);
// Update the vtable pointers in all of the Klass objects in the
// heap. They should point to newly generated vtable.
--- 547,560 ----
const double rw_u_perc = rw_bytes / double(rw_alloced) * 100.0;
const double md_u_perc = md_bytes / double(md_alloced) * 100.0;
const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
! tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
! tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
! tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
! tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
tty->print_cr("total : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]",
total_bytes, total_alloced, total_u_perc);
// Update the vtable pointers in all of the Klass objects in the
// heap. They should point to newly generated vtable.
*** 601,610 ****
--- 605,615 ----
dac.iterate_metaspace(_loader_data->ro_metaspace(), DumpAllocClosure::RO);
dac.iterate_metaspace(_loader_data->rw_metaspace(), DumpAllocClosure::RW);
dac.dump_stats(int(ro_bytes), int(rw_bytes), int(md_bytes), int(mc_bytes));
}
+ #undef fmt_space
}
static void link_shared_classes(Klass* obj, TRAPS) {
Klass* k = obj;
if (k->oop_is_instance()) {
src/share/vm/memory/metaspaceShared.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File