src/hotspot/share/memory/metaspaceShared.cpp
changeset 47574 15294343ba19
parent 47216 71c04702a3d5
child 47599 0fb1d501c408
equal deleted inserted replaced
47572:552a97e8edad 47574:15294343ba19
   163     }
   163     }
   164     return used / double(total) * 100.0;
   164     return used / double(total) * 100.0;
   165   }
   165   }
   166 
   166 
   167   void print(size_t total_bytes) const {
   167   void print(size_t total_bytes) const {
   168     tty->print_cr("%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT,
   168     tty->print_cr("%-3s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT,
   169                   _name, used(), perc(used(), total_bytes), reserved(), perc(used(), reserved()), p2i(_base));
   169                   _name, used(), perc(used(), total_bytes), reserved(), perc(used(), reserved()), p2i(_base));
   170   }
   170   }
   171   void print_out_of_space_msg(const char* failing_region, size_t needed_bytes) {
   171   void print_out_of_space_msg(const char* failing_region, size_t needed_bytes) {
   172     tty->print("[%-8s] " PTR_FORMAT " - " PTR_FORMAT " capacity =%9d, allocated =%9d",
   172     tty->print("[%-8s] " PTR_FORMAT " - " PTR_FORMAT " capacity =%9d, allocated =%9d",
   173                _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
   173                _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
  1403   _md_region.print(total_reserved);
  1403   _md_region.print(total_reserved);
  1404   _od_region.print(total_reserved);
  1404   _od_region.print(total_reserved);
  1405   print_heap_region_stats(_string_regions, "st", total_reserved);
  1405   print_heap_region_stats(_string_regions, "st", total_reserved);
  1406   print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved);
  1406   print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved);
  1407 
  1407 
  1408   tty->print_cr("total   : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]",
  1408   tty->print_cr("total    : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]",
  1409                  total_bytes, total_reserved, total_u_perc);
  1409                  total_bytes, total_reserved, total_u_perc);
  1410 }
  1410 }
  1411 
  1411 
  1412 void VM_PopulateDumpSharedSpace::print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
  1412 void VM_PopulateDumpSharedSpace::print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
  1413                                                          const char *name, const size_t total_size) {
  1413                                                          const char *name, const size_t total_size) {
  1414   int arr_len = heap_mem == NULL ? 0 : heap_mem->length();
  1414   int arr_len = heap_mem == NULL ? 0 : heap_mem->length();
  1415   for (int i = 0; i < arr_len; i++) {
  1415   for (int i = 0; i < arr_len; i++) {
  1416       char* start = (char*)heap_mem->at(i).start();
  1416       char* start = (char*)heap_mem->at(i).start();
  1417       size_t size = heap_mem->at(i).byte_size();
  1417       size_t size = heap_mem->at(i).byte_size();
  1418       char* top = start + size;
  1418       char* top = start + size;
  1419       tty->print_cr("%s%d space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100%% used] at " INTPTR_FORMAT,
  1419       tty->print_cr("%s%d space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used] at " INTPTR_FORMAT,
  1420                     name, i, size, size/double(total_size)*100.0, size, p2i(start));
  1420                     name, i, size, size/double(total_size)*100.0, size, p2i(start));
  1421 
  1421 
  1422   }
  1422   }
  1423 }
  1423 }
  1424 
  1424