< prev index next >

src/share/vm/services/virtualMemoryTracker.hpp

Print this page
rev 12121 : 8167650: NMT should check for invalid MEMFLAGS
Reviewed-by: dholmes, mockner


  76   inline void commit_memory (size_t sz)  { data()->commit_memory(sz);   }
  77   inline void uncommit_memory(size_t sz) { data()->uncommit_memory(sz); }
  78   inline void release_memory(size_t sz)  { data()->release_memory(sz);  }
  79   inline size_t reserved() const  { return peek()->reserved(); }
  80   inline size_t committed() const { return peek()->committed(); }
  81 };
  82 
  83 class VirtualMemorySummary;
  84 
  85 // This class represents a snapshot of virtual memory at a given time.
  86 // The latest snapshot is saved in a static area.
  87 class VirtualMemorySnapshot : public ResourceObj {
  88   friend class VirtualMemorySummary;
  89 
  90  private:
  91   VirtualMemory  _virtual_memory[mt_number_of_types];
  92 
  93  public:
  94   inline VirtualMemory* by_type(MEMFLAGS flag) {
  95     int index = NMTUtil::flag_to_index(flag);

  96     return &_virtual_memory[index];
  97   }
  98 
  99   inline VirtualMemory* by_index(int index) {
 100     assert(index >= 0, "Index out of bound");
 101     assert(index < mt_number_of_types, "Index out of bound");
 102     return &_virtual_memory[index];
 103   }
 104 
 105   inline size_t total_reserved() const {
 106     size_t amount = 0;
 107     for (int index = 0; index < mt_number_of_types; index ++) {
 108       amount += _virtual_memory[index].reserved();
 109     }
 110     return amount;
 111   }
 112 
 113   inline size_t total_committed() const {
 114     size_t amount = 0;
 115     for (int index = 0; index < mt_number_of_types; index ++) {




  76   inline void commit_memory (size_t sz)  { data()->commit_memory(sz);   }
  77   inline void uncommit_memory(size_t sz) { data()->uncommit_memory(sz); }
  78   inline void release_memory(size_t sz)  { data()->release_memory(sz);  }
  79   inline size_t reserved() const  { return peek()->reserved(); }
  80   inline size_t committed() const { return peek()->committed(); }
  81 };
  82 
  83 class VirtualMemorySummary;
  84 
  85 // This class represents a snapshot of virtual memory at a given time.
  86 // The latest snapshot is saved in a static area.
  87 class VirtualMemorySnapshot : public ResourceObj {
  88   friend class VirtualMemorySummary;
  89 
  90  private:
  91   VirtualMemory  _virtual_memory[mt_number_of_types];
  92 
  93  public:
  94   inline VirtualMemory* by_type(MEMFLAGS flag) {
  95     int index = NMTUtil::flag_to_index(flag);
  96     assert(index >= 0 && index < mt_number_of_types, "Index out of bound.");
  97     return &_virtual_memory[index];
  98   }
  99 
 100   inline VirtualMemory* by_index(int index) {
 101     assert(index >= 0, "Index out of bound");
 102     assert(index < mt_number_of_types, "Index out of bound");
 103     return &_virtual_memory[index];
 104   }
 105 
 106   inline size_t total_reserved() const {
 107     size_t amount = 0;
 108     for (int index = 0; index < mt_number_of_types; index ++) {
 109       amount += _virtual_memory[index].reserved();
 110     }
 111     return amount;
 112   }
 113 
 114   inline size_t total_committed() const {
 115     size_t amount = 0;
 116     for (int index = 0; index < mt_number_of_types; index ++) {


< prev index next >