src/share/vm/services/memoryManager.hpp

Print this page




 135   void set_start_time(jlong time) { _start_time = time; }
 136   void set_end_time(jlong time)   { _end_time = time; }
 137   void set_before_gc_usage(int pool_index, MemoryUsage usage) {
 138     assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking");
 139     set_gc_usage(pool_index, usage, true /* before gc */);
 140   }
 141   void set_after_gc_usage(int pool_index, MemoryUsage usage) {
 142     assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking");
 143     set_gc_usage(pool_index, usage, false /* after gc */);
 144   }
 145 
 146   void copy_stat(GCStatInfo* stat);
 147 };
 148 
 149 class GCMemoryManager : public MemoryManager {
 150 private:
 151   // TODO: We should unify the GCCounter and GCMemoryManager statistic
 152   size_t       _num_collections;
 153   elapsedTimer _accumulated_timer;
 154   elapsedTimer _gc_timer;         // for measuring every GC duration
 155   GCStatInfo*  _last_gc_stat;

 156   int          _num_gc_threads;
 157 public:
 158   GCMemoryManager();
 159   ~GCMemoryManager();
 160 
 161   void   initialize_gc_stat_info();
 162 
 163   bool   is_gc_memory_manager()         { return true; }
 164   jlong  gc_time_ms()                   { return _accumulated_timer.milliseconds(); }
 165   size_t gc_count()                     { return _num_collections; }
 166   int    num_gc_threads()               { return _num_gc_threads; }
 167   void   set_num_gc_threads(int count)  { _num_gc_threads = count; }
 168 
 169   void   gc_begin();
 170   void   gc_end();


 171 

 172   void        reset_gc_stat()   { _num_collections = 0; _accumulated_timer.reset(); }
 173   GCStatInfo* last_gc_stat()    { return _last_gc_stat; }
 174 
 175   virtual MemoryManager::Name kind() = 0;
 176 };
 177 
 178 // These subclasses of GCMemoryManager are defined to include
 179 // GC-specific information.
 180 // TODO: Add GC-specific information
 181 class CopyMemoryManager : public GCMemoryManager {
 182 private:
 183 public:
 184   CopyMemoryManager() : GCMemoryManager() {}
 185 
 186   MemoryManager::Name kind() { return MemoryManager::Copy; }
 187   const char* name()         { return "Copy"; }
 188 };
 189 
 190 class MSCMemoryManager : public GCMemoryManager {
 191 private:




 135   void set_start_time(jlong time) { _start_time = time; }
 136   void set_end_time(jlong time)   { _end_time = time; }
 137   void set_before_gc_usage(int pool_index, MemoryUsage usage) {
 138     assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking");
 139     set_gc_usage(pool_index, usage, true /* before gc */);
 140   }
 141   void set_after_gc_usage(int pool_index, MemoryUsage usage) {
 142     assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking");
 143     set_gc_usage(pool_index, usage, false /* after gc */);
 144   }
 145 
 146   void copy_stat(GCStatInfo* stat);
 147 };
 148 
 149 class GCMemoryManager : public MemoryManager {
 150 private:
 151   // TODO: We should unify the GCCounter and GCMemoryManager statistic
 152   size_t       _num_collections;
 153   elapsedTimer _accumulated_timer;
 154   elapsedTimer _gc_timer;         // for measuring every GC duration
 155   GCStatInfo*  volatile _last_gc_stat;
 156   GCStatInfo*  volatile _current_gc_stat;
 157   int          _num_gc_threads;
 158 public:
 159   GCMemoryManager();
 160   ~GCMemoryManager();
 161 
 162   void   initialize_gc_stat_info();
 163 
 164   bool   is_gc_memory_manager()         { return true; }
 165   jlong  gc_time_ms()                   { return _accumulated_timer.milliseconds(); }
 166   size_t gc_count()                     { return _num_collections; }
 167   int    num_gc_threads()               { return _num_gc_threads; }
 168   void   set_num_gc_threads(int count)  { _num_gc_threads = count; }
 169 
 170   void   gc_begin(bool recordGCBeginTime, bool recordPreGCUsage,
 171                   bool recordAccumulatedGCTime);
 172   void   gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime,
 173                 bool recordGCEndTime, bool countCollection);
 174 
 175 
 176   void        reset_gc_stat()   { _num_collections = 0; _accumulated_timer.reset(); }
 177   GCStatInfo* last_gc_stat() { return _last_gc_stat; }
 178 
 179   virtual MemoryManager::Name kind() = 0;
 180 };
 181 
 182 // These subclasses of GCMemoryManager are defined to include
 183 // GC-specific information.
 184 // TODO: Add GC-specific information
 185 class CopyMemoryManager : public GCMemoryManager {
 186 private:
 187 public:
 188   CopyMemoryManager() : GCMemoryManager() {}
 189 
 190   MemoryManager::Name kind() { return MemoryManager::Copy; }
 191   const char* name()         { return "Copy"; }
 192 };
 193 
 194 class MSCMemoryManager : public GCMemoryManager {
 195 private: