< prev index next >

src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp

Print this page




 279 // Survivor Space rescan.
 280 class ChunkArray: public CHeapObj<mtGC> {
 281   size_t _index;
 282   size_t _capacity;
 283   size_t _overflows;
 284   HeapWord** _array;   // storage for array
 285 
 286  public:
 287   ChunkArray() : _index(0), _capacity(0), _overflows(0), _array(NULL) {}
 288   ChunkArray(HeapWord** a, size_t c):
 289     _index(0), _capacity(c), _overflows(0), _array(a) {}
 290 
 291   HeapWord** array() { return _array; }
 292   void set_array(HeapWord** a) { _array = a; }
 293 
 294   size_t capacity() { return _capacity; }
 295   void set_capacity(size_t c) { _capacity = c; }
 296 
 297   size_t end() {
 298     assert(_index <= capacity(),
 299            err_msg("_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT "): out of bounds",
 300                    _index, _capacity));
 301     return _index;
 302   }  // exclusive
 303 
 304   HeapWord* nth(size_t n) {
 305     assert(n < end(), "Out of bounds access");
 306     return _array[n];
 307   }
 308 
 309   void reset() {
 310     _index = 0;
 311     if (_overflows > 0 && PrintCMSStatistics > 1) {
 312       warning("CMS: ChunkArray[" SIZE_FORMAT "] overflowed " SIZE_FORMAT " times",
 313               _capacity, _overflows);
 314     }
 315     _overflows = 0;
 316   }
 317 
 318   void record_sample(HeapWord* p, size_t sz) {
 319     // For now we do not do anything with the size
 320     if (_index < _capacity) {
 321       _array[_index++] = p;
 322     } else {
 323       ++_overflows;
 324       assert(_index == _capacity,
 325              err_msg("_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT
 326                      "): out of bounds at overflow#" SIZE_FORMAT,
 327                      _index, _capacity, _overflows));
 328     }
 329   }
 330 };
 331 
 332 //
 333 // Timing, allocation and promotion statistics for gc scheduling and incremental
 334 // mode pacing.  Most statistics are exponential averages.
 335 //
 336 class CMSStats VALUE_OBJ_CLASS_SPEC {
 337  private:
 338   ConcurrentMarkSweepGeneration* const _cms_gen;   // The cms (old) gen.
 339 
 340   // The following are exponential averages with factor alpha:
 341   //   avg = (100 - alpha) * avg + alpha * cur_sample
 342   //
 343   //   The durations measure:  end_time[n] - start_time[n]
 344   //   The periods measure:    start_time[n] - start_time[n-1]
 345   //
 346   // The cms period and duration include only concurrent collections; time spent
 347   // in foreground cms collections due to System.gc() or because of a failure to




 279 // Survivor Space rescan.
 280 class ChunkArray: public CHeapObj<mtGC> {
 281   size_t _index;
 282   size_t _capacity;
 283   size_t _overflows;
 284   HeapWord** _array;   // storage for array
 285 
 286  public:
 287   ChunkArray() : _index(0), _capacity(0), _overflows(0), _array(NULL) {}
 288   ChunkArray(HeapWord** a, size_t c):
 289     _index(0), _capacity(c), _overflows(0), _array(a) {}
 290 
 291   HeapWord** array() { return _array; }
 292   void set_array(HeapWord** a) { _array = a; }
 293 
 294   size_t capacity() { return _capacity; }
 295   void set_capacity(size_t c) { _capacity = c; }
 296 
 297   size_t end() {
 298     assert(_index <= capacity(),
 299            "_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT "): out of bounds",
 300            _index, _capacity);
 301     return _index;
 302   }  // exclusive
 303 
 304   HeapWord* nth(size_t n) {
 305     assert(n < end(), "Out of bounds access");
 306     return _array[n];
 307   }
 308 
 309   void reset() {
 310     _index = 0;
 311     if (_overflows > 0 && PrintCMSStatistics > 1) {
 312       warning("CMS: ChunkArray[" SIZE_FORMAT "] overflowed " SIZE_FORMAT " times",
 313               _capacity, _overflows);
 314     }
 315     _overflows = 0;
 316   }
 317 
 318   void record_sample(HeapWord* p, size_t sz) {
 319     // For now we do not do anything with the size
 320     if (_index < _capacity) {
 321       _array[_index++] = p;
 322     } else {
 323       ++_overflows;
 324       assert(_index == _capacity,
 325              "_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT
 326              "): out of bounds at overflow#" SIZE_FORMAT,
 327              _index, _capacity, _overflows);
 328     }
 329   }
 330 };
 331 
 332 //
 333 // Timing, allocation and promotion statistics for gc scheduling and incremental
 334 // mode pacing.  Most statistics are exponential averages.
 335 //
 336 class CMSStats VALUE_OBJ_CLASS_SPEC {
 337  private:
 338   ConcurrentMarkSweepGeneration* const _cms_gen;   // The cms (old) gen.
 339 
 340   // The following are exponential averages with factor alpha:
 341   //   avg = (100 - alpha) * avg + alpha * cur_sample
 342   //
 343   //   The durations measure:  end_time[n] - start_time[n]
 344   //   The periods measure:    start_time[n] - start_time[n-1]
 345   //
 346   // The cms period and duration include only concurrent collections; time spent
 347   // in foreground cms collections due to System.gc() or because of a failure to


< prev index next >