comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 3764:053d84a76d3d

7032531: G1: enhance GC logging to include more accurate eden / survivor size transitions Summary: This changeset extends the logging information generated by +PrintGCDetails to also print out separate size transitions for the eden, survivors, and old regions. Reviewed-by: ysr, brutisso
author tonyp
date Wed, 08 Jun 2011 15:31:51 -0400
parents 5c0b591e1074
children ae5b2f1dcf12
comparison
equal deleted inserted replaced
3763:e66f38dd58a9 3764:053d84a76d3d
237 _initiate_conc_mark_if_possible(false), 237 _initiate_conc_mark_if_possible(false),
238 _during_initial_mark_pause(false), 238 _during_initial_mark_pause(false),
239 _should_revert_to_full_young_gcs(false), 239 _should_revert_to_full_young_gcs(false),
240 _last_full_young_gc(false), 240 _last_full_young_gc(false),
241 241
242 _eden_bytes_before_gc(0),
243 _survivor_bytes_before_gc(0),
244 _capacity_before_gc(0),
245
242 _prev_collection_pause_used_at_end_bytes(0), 246 _prev_collection_pause_used_at_end_bytes(0),
243 247
244 _collection_set(NULL), 248 _collection_set(NULL),
245 _collection_set_size(0), 249 _collection_set_size(0),
246 _collection_set_bytes_used_before(0), 250 _collection_set_bytes_used_before(0),
894 _max_pending_cards = _g1->max_pending_card_num(); 898 _max_pending_cards = _g1->max_pending_card_num();
895 899
896 _bytes_in_to_space_before_gc = 0; 900 _bytes_in_to_space_before_gc = 0;
897 _bytes_in_to_space_after_gc = 0; 901 _bytes_in_to_space_after_gc = 0;
898 _bytes_in_collection_set_before_gc = 0; 902 _bytes_in_collection_set_before_gc = 0;
903
904 YoungList* young_list = _g1->young_list();
905 _eden_bytes_before_gc = young_list->eden_used_bytes();
906 _survivor_bytes_before_gc = young_list->survivor_used_bytes();
907 _capacity_before_gc = _g1->capacity();
899 908
900 #ifdef DEBUG 909 #ifdef DEBUG
901 // initialise these to something well known so that we can spot 910 // initialise these to something well known so that we can spot
902 // if they are not set properly 911 // if they are not set properly
903 912
1458 sprintf(buffer, "Aux%d", i); 1467 sprintf(buffer, "Aux%d", i);
1459 print_stats(1, buffer, _cur_aux_times_ms[i]); 1468 print_stats(1, buffer, _cur_aux_times_ms[i]);
1460 } 1469 }
1461 } 1470 }
1462 } 1471 }
1463 if (PrintGCDetails)
1464 gclog_or_tty->print(" [");
1465 if (PrintGC || PrintGCDetails)
1466 _g1->print_size_transition(gclog_or_tty,
1467 _cur_collection_pause_used_at_start_bytes,
1468 _g1->used(), _g1->capacity());
1469 if (PrintGCDetails)
1470 gclog_or_tty->print_cr("]");
1471 1472
1472 _all_pause_times_ms->add(elapsed_ms); 1473 _all_pause_times_ms->add(elapsed_ms);
1473 if (update_stats) { 1474 if (update_stats) {
1474 summary->record_total_time_ms(elapsed_ms); 1475 summary->record_total_time_ms(elapsed_ms);
1475 summary->record_other_time_ms(other_time_ms); 1476 summary->record_other_time_ms(other_time_ms);
1668 1669
1669 // Note that _mmu_tracker->max_gc_time() returns the time in seconds. 1670 // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
1670 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; 1671 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
1671 adjust_concurrent_refinement(update_rs_time, update_rs_processed_buffers, update_rs_time_goal_ms); 1672 adjust_concurrent_refinement(update_rs_time, update_rs_processed_buffers, update_rs_time_goal_ms);
1672 // </NEW PREDICTION> 1673 // </NEW PREDICTION>
1674 }
1675
1676 #define EXT_SIZE_FORMAT "%d%s"
1677 #define EXT_SIZE_PARAMS(bytes) \
1678 byte_size_in_proper_unit((bytes)), \
1679 proper_unit_for_byte_size((bytes))
1680
1681 void G1CollectorPolicy::print_heap_transition() {
1682 if (PrintGCDetails) {
1683 YoungList* young_list = _g1->young_list();
1684 size_t eden_bytes = young_list->eden_used_bytes();
1685 size_t survivor_bytes = young_list->survivor_used_bytes();
1686 size_t used_before_gc = _cur_collection_pause_used_at_start_bytes;
1687 size_t used = _g1->used();
1688 size_t capacity = _g1->capacity();
1689
1690 gclog_or_tty->print_cr(
1691 " [Eden: "EXT_SIZE_FORMAT"->"EXT_SIZE_FORMAT" "
1692 "Survivors: "EXT_SIZE_FORMAT"->"EXT_SIZE_FORMAT" "
1693 "Heap: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"
1694 EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")]",
1695 EXT_SIZE_PARAMS(_eden_bytes_before_gc),
1696 EXT_SIZE_PARAMS(eden_bytes),
1697 EXT_SIZE_PARAMS(_survivor_bytes_before_gc),
1698 EXT_SIZE_PARAMS(survivor_bytes),
1699 EXT_SIZE_PARAMS(used_before_gc),
1700 EXT_SIZE_PARAMS(_capacity_before_gc),
1701 EXT_SIZE_PARAMS(used),
1702 EXT_SIZE_PARAMS(capacity));
1703 } else if (PrintGC) {
1704 _g1->print_size_transition(gclog_or_tty,
1705 _cur_collection_pause_used_at_start_bytes,
1706 _g1->used(), _g1->capacity());
1707 }
1673 } 1708 }
1674 1709
1675 // <NEW PREDICTION> 1710 // <NEW PREDICTION>
1676 1711
1677 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time, 1712 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,