4719 }
4720 return bytes;
4721 }
4722
4723 // It deduces the values for a region in a humongous region series
4724 // from the _hum_* fields and updates those accordingly. It assumes
4725 // that that _hum_* fields have already been set up from the "starts
4726 // humongous" region and we visit the regions in address order.
4727 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4728 size_t* capacity_bytes,
4729 size_t* prev_live_bytes,
4730 size_t* next_live_bytes) {
4731 assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4732 *used_bytes = get_hum_bytes(&_hum_used_bytes);
4733 *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes);
4734 *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4735 *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4736 }
4737
4738 bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
4739 const char* type = "";
4740 HeapWord* bottom = r->bottom();
4741 HeapWord* end = r->end();
4742 size_t capacity_bytes = r->capacity();
4743 size_t used_bytes = r->used();
4744 size_t prev_live_bytes = r->live_bytes();
4745 size_t next_live_bytes = r->next_live_bytes();
4746 double gc_eff = r->gc_efficiency();
4747 size_t remset_bytes = r->rem_set()->mem_size();
4748 size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size();
4749
4750 if (r->used() == 0) {
4751 type = "FREE";
4752 } else if (r->is_survivor()) {
4753 type = "SURV";
4754 } else if (r->is_young()) {
4755 type = "EDEN";
4756 } else if (r->startsHumongous()) {
4757 type = "HUMS";
4758
4759 assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 &&
4760 _hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0,
4761 "they should have been zeroed after the last time we used them");
4762 // Set up the _hum_* fields.
4763 _hum_capacity_bytes = capacity_bytes;
4764 _hum_used_bytes = used_bytes;
4765 _hum_prev_live_bytes = prev_live_bytes;
4766 _hum_next_live_bytes = next_live_bytes;
4767 get_hum_bytes(&used_bytes, &capacity_bytes,
4768 &prev_live_bytes, &next_live_bytes);
4769 end = bottom + HeapRegion::GrainWords;
4770 } else if (r->continuesHumongous()) {
4771 type = "HUMC";
4772 get_hum_bytes(&used_bytes, &capacity_bytes,
4773 &prev_live_bytes, &next_live_bytes);
4774 assert(end == bottom + HeapRegion::GrainWords, "invariant");
4775 } else {
4776 type = "OLD";
4777 }
4778
4779 _total_used_bytes += used_bytes;
4780 _total_capacity_bytes += capacity_bytes;
4781 _total_prev_live_bytes += prev_live_bytes;
4782 _total_next_live_bytes += next_live_bytes;
4783 _total_remset_bytes += remset_bytes;
4784 _total_strong_code_roots_bytes += strong_code_roots_bytes;
4785
4786 // Print a line for this particular region.
4787 _out->print_cr(G1PPRL_LINE_PREFIX
4788 G1PPRL_TYPE_FORMAT
4789 G1PPRL_ADDR_BASE_FORMAT
4790 G1PPRL_BYTE_FORMAT
4791 G1PPRL_BYTE_FORMAT
4792 G1PPRL_BYTE_FORMAT
4793 G1PPRL_DOUBLE_FORMAT
4794 G1PPRL_BYTE_FORMAT
4795 G1PPRL_BYTE_FORMAT,
4796 type, p2i(bottom), p2i(end),
|
4719 }
4720 return bytes;
4721 }
4722
4723 // It deduces the values for a region in a humongous region series
4724 // from the _hum_* fields and updates those accordingly. It assumes
4725 // that that _hum_* fields have already been set up from the "starts
4726 // humongous" region and we visit the regions in address order.
4727 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4728 size_t* capacity_bytes,
4729 size_t* prev_live_bytes,
4730 size_t* next_live_bytes) {
4731 assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4732 *used_bytes = get_hum_bytes(&_hum_used_bytes);
4733 *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes);
4734 *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4735 *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4736 }
4737
4738 bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
4739 const char* type = r->get_type_str();
4740 HeapWord* bottom = r->bottom();
4741 HeapWord* end = r->end();
4742 size_t capacity_bytes = r->capacity();
4743 size_t used_bytes = r->used();
4744 size_t prev_live_bytes = r->live_bytes();
4745 size_t next_live_bytes = r->next_live_bytes();
4746 double gc_eff = r->gc_efficiency();
4747 size_t remset_bytes = r->rem_set()->mem_size();
4748 size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size();
4749
4750 if (r->startsHumongous()) {
4751 assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 &&
4752 _hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0,
4753 "they should have been zeroed after the last time we used them");
4754 // Set up the _hum_* fields.
4755 _hum_capacity_bytes = capacity_bytes;
4756 _hum_used_bytes = used_bytes;
4757 _hum_prev_live_bytes = prev_live_bytes;
4758 _hum_next_live_bytes = next_live_bytes;
4759 get_hum_bytes(&used_bytes, &capacity_bytes,
4760 &prev_live_bytes, &next_live_bytes);
4761 end = bottom + HeapRegion::GrainWords;
4762 } else if (r->continuesHumongous()) {
4763 get_hum_bytes(&used_bytes, &capacity_bytes,
4764 &prev_live_bytes, &next_live_bytes);
4765 assert(end == bottom + HeapRegion::GrainWords, "invariant");
4766 }
4767
4768 _total_used_bytes += used_bytes;
4769 _total_capacity_bytes += capacity_bytes;
4770 _total_prev_live_bytes += prev_live_bytes;
4771 _total_next_live_bytes += next_live_bytes;
4772 _total_remset_bytes += remset_bytes;
4773 _total_strong_code_roots_bytes += strong_code_roots_bytes;
4774
4775 // Print a line for this particular region.
4776 _out->print_cr(G1PPRL_LINE_PREFIX
4777 G1PPRL_TYPE_FORMAT
4778 G1PPRL_ADDR_BASE_FORMAT
4779 G1PPRL_BYTE_FORMAT
4780 G1PPRL_BYTE_FORMAT
4781 G1PPRL_BYTE_FORMAT
4782 G1PPRL_DOUBLE_FORMAT
4783 G1PPRL_BYTE_FORMAT
4784 G1PPRL_BYTE_FORMAT,
4785 type, p2i(bottom), p2i(end),
|