< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page
rev 48820 : [mq]: 8196602-heapregionclosure-renaming


 511 
 512 class OldRegionsLivenessClosure: public HeapRegionClosure {
 513 
 514  private:
 515   const int _liveness;
 516   size_t _total_count;
 517   size_t _total_memory;
 518   size_t _total_memory_to_free;
 519 
 520  public:
 521   OldRegionsLivenessClosure(int liveness) :
 522     _liveness(liveness),
 523     _total_count(0),
 524     _total_memory(0),
 525     _total_memory_to_free(0) { }
 526 
 527     size_t total_count() { return _total_count; }
 528     size_t total_memory() { return _total_memory; }
 529     size_t total_memory_to_free() { return _total_memory_to_free; }
 530 
 531   bool doHeapRegion(HeapRegion* r) {
 532     if (r->is_old()) {
 533       size_t prev_live = r->marked_bytes();
 534       size_t live = r->live_bytes();
 535       size_t size = r->used();
 536       size_t reg_size = HeapRegion::GrainBytes;
 537       if (size > 0 && ((int)(live * 100 / size) < _liveness)) {
 538         _total_memory += size;
 539         ++_total_count;
 540         if (size == reg_size) {
 541         // we don't include non-full regions since they are unlikely included in mixed gc
 542         // for testing purposes it's enough to have lowest estimation of total memory that is expected to be freed
 543           _total_memory_to_free += size - prev_live;
 544         }
 545       }
 546     }
 547     return false;
 548   }
 549 };
 550 
 551 




 511 
 512 class OldRegionsLivenessClosure: public HeapRegionClosure {
 513 
 514  private:
 515   const int _liveness;
 516   size_t _total_count;
 517   size_t _total_memory;
 518   size_t _total_memory_to_free;
 519 
 520  public:
 521   OldRegionsLivenessClosure(int liveness) :
 522     _liveness(liveness),
 523     _total_count(0),
 524     _total_memory(0),
 525     _total_memory_to_free(0) { }
 526 
 527     size_t total_count() { return _total_count; }
 528     size_t total_memory() { return _total_memory; }
 529     size_t total_memory_to_free() { return _total_memory_to_free; }
 530 
 531   bool do_heap_region(HeapRegion* r) {
 532     if (r->is_old()) {
 533       size_t prev_live = r->marked_bytes();
 534       size_t live = r->live_bytes();
 535       size_t size = r->used();
 536       size_t reg_size = HeapRegion::GrainBytes;
 537       if (size > 0 && ((int)(live * 100 / size) < _liveness)) {
 538         _total_memory += size;
 539         ++_total_count;
 540         if (size == reg_size) {
 541         // we don't include non-full regions since they are unlikely included in mixed gc
 542         // for testing purposes it's enough to have lowest estimation of total memory that is expected to be freed
 543           _total_memory_to_free += size - prev_live;
 544         }
 545       }
 546     }
 547     return false;
 548   }
 549 };
 550 
 551 


< prev index next >