< prev index next >

src/hotspot/share/memory/metaspaceShared.cpp

Print this page


 148   }
 149 
 150   char* base()      const { return _base;        }
 151   char* top()       const { return _top;         }
 152   char* end()       const { return _end;         }
 153   size_t reserved() const { return _end - _base; }
 154   size_t used()     const { return _top - _base; }
 155   bool is_packed()  const { return _is_packed;   }
 156   bool is_allocatable() const {
 157     return !is_packed() && _base != NULL;
 158   }
 159 
 160   double perc(size_t used, size_t total) const {
 161     if (total == 0) {
 162       total = 1;
 163     }
 164     return used / double(total) * 100.0;
 165   }
 166 
 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,
 169                   _name, used(), perc(used(), total_bytes), reserved(), perc(used(), reserved()), p2i(_base));
 170   }
 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",
 173                _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
 174     if (strcmp(_name, failing_region) == 0) {
 175       tty->print_cr(" required = %d", int(needed_bytes));
 176     } else {
 177       tty->cr();
 178     }
 179   }
 180 
 181   void init(const ReservedSpace* rs) {
 182     _base = _top = rs->base();
 183     _end = rs->end();
 184   }
 185   void init(char* b, char* t, char* e) {
 186     _base = b;
 187     _top = t;
 188     _end = e;




 148   }
 149 
 150   char* base()      const { return _base;        }
 151   char* top()       const { return _top;         }
 152   char* end()       const { return _end;         }
 153   size_t reserved() const { return _end - _base; }
 154   size_t used()     const { return _top - _base; }
 155   bool is_packed()  const { return _is_packed;   }
 156   bool is_allocatable() const {
 157     return !is_packed() && _base != NULL;
 158   }
 159 
 160   double perc(size_t used, size_t total) const {
 161     if (total == 0) {
 162       total = 1;
 163     }
 164     return used / double(total) * 100.0;
 165   }
 166 
 167   void print(size_t total_bytes) const {
 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));
 170   }
 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",
 173                _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
 174     if (strcmp(_name, failing_region) == 0) {
 175       tty->print_cr(" required = %d", int(needed_bytes));
 176     } else {
 177       tty->cr();
 178     }
 179   }
 180 
 181   void init(const ReservedSpace* rs) {
 182     _base = _top = rs->base();
 183     _end = rs->end();
 184   }
 185   void init(char* b, char* t, char* e) {
 186     _base = b;
 187     _top = t;
 188     _end = e;


< prev index next >