src/hotspot/share/memory/metaspaceShared.cpp
changeset 48962 88ad6c676c87
parent 48794 ea0d0781c63c
child 49329 04ed29f9ef33
equal deleted inserted replaced
48961:120b61d50f85 48962:88ad6c676c87
   881 // To make fmt_stats be a syntactic constant (for format warnings), use #define.
   881 // To make fmt_stats be a syntactic constant (for format warnings), use #define.
   882 #define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"
   882 #define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"
   883   const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
   883   const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
   884   const char *hdr = "                        ro_cnt   ro_bytes     % |   rw_cnt   rw_bytes     % |  all_cnt  all_bytes     %";
   884   const char *hdr = "                        ro_cnt   ro_bytes     % |   rw_cnt   rw_bytes     % |  all_cnt  all_bytes     %";
   885 
   885 
   886   ResourceMark rm;
       
   887   LogMessage(cds) msg;
   886   LogMessage(cds) msg;
   888   stringStream info_stream;
   887 
   889 
   888   msg.info("Detailed metadata info (excluding od/st regions; rw stats include md/mc regions):");
   890   info_stream.print_cr("Detailed metadata info (excluding od/st regions; rw stats include md/mc regions):");
   889   msg.info("%s", hdr);
   891   info_stream.print_cr("%s", hdr);
   890   msg.info("%s", sep);
   892   info_stream.print_cr("%s", sep);
       
   893   for (int type = 0; type < int(_number_of_types); type ++) {
   891   for (int type = 0; type < int(_number_of_types); type ++) {
   894     const char *name = type_name((Type)type);
   892     const char *name = type_name((Type)type);
   895     int ro_count = _counts[RO][type];
   893     int ro_count = _counts[RO][type];
   896     int ro_bytes = _bytes [RO][type];
   894     int ro_bytes = _bytes [RO][type];
   897     int rw_count = _counts[RW][type];
   895     int rw_count = _counts[RW][type];
   901 
   899 
   902     double ro_perc = percent_of(ro_bytes, ro_all);
   900     double ro_perc = percent_of(ro_bytes, ro_all);
   903     double rw_perc = percent_of(rw_bytes, rw_all);
   901     double rw_perc = percent_of(rw_bytes, rw_all);
   904     double perc    = percent_of(bytes, ro_all + rw_all);
   902     double perc    = percent_of(bytes, ro_all + rw_all);
   905 
   903 
   906     info_stream.print_cr(fmt_stats, name,
   904     msg.info(fmt_stats, name,
   907                          ro_count, ro_bytes, ro_perc,
   905                          ro_count, ro_bytes, ro_perc,
   908                          rw_count, rw_bytes, rw_perc,
   906                          rw_count, rw_bytes, rw_perc,
   909                          count, bytes, perc);
   907                          count, bytes, perc);
   910 
   908 
   911     all_ro_count += ro_count;
   909     all_ro_count += ro_count;
   919 
   917 
   920   double all_ro_perc = percent_of(all_ro_bytes, ro_all);
   918   double all_ro_perc = percent_of(all_ro_bytes, ro_all);
   921   double all_rw_perc = percent_of(all_rw_bytes, rw_all);
   919   double all_rw_perc = percent_of(all_rw_bytes, rw_all);
   922   double all_perc    = percent_of(all_bytes, ro_all + rw_all);
   920   double all_perc    = percent_of(all_bytes, ro_all + rw_all);
   923 
   921 
   924   info_stream.print_cr("%s", sep);
   922   msg.info("%s", sep);
   925   info_stream.print_cr(fmt_stats, "Total",
   923   msg.info(fmt_stats, "Total",
   926                        all_ro_count, all_ro_bytes, all_ro_perc,
   924                        all_ro_count, all_ro_bytes, all_ro_perc,
   927                        all_rw_count, all_rw_bytes, all_rw_perc,
   925                        all_rw_count, all_rw_bytes, all_rw_perc,
   928                        all_count, all_bytes, all_perc);
   926                        all_count, all_bytes, all_perc);
   929 
   927 
   930   assert(all_ro_bytes == ro_all, "everything should have been counted");
   928   assert(all_ro_bytes == ro_all, "everything should have been counted");
   931   assert(all_rw_bytes == rw_all, "everything should have been counted");
   929   assert(all_rw_bytes == rw_all, "everything should have been counted");
   932 
   930 
   933   msg.info("%s", info_stream.as_string());
       
   934 #undef fmt_stats
   931 #undef fmt_stats
   935 }
   932 }
   936 
   933 
   937 // Populate the shared space.
   934 // Populate the shared space.
   938 
   935