comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 10100:9aa8d8037ee3

Merge
author mgerdin
date Tue, 16 Apr 2013 12:46:24 +0200
parents cc32ccaaf47f 71013d764f6e
children f14063dcd52a
comparison
equal deleted inserted replaced
9149:c60f69931e1a 10100:9aa8d8037ee3
1 /* 1 /*
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
404 } else { 404 } else {
405 _young_list_fixed_length = _young_gen_sizer->min_desired_young_length(); 405 _young_list_fixed_length = _young_gen_sizer->min_desired_young_length();
406 } 406 }
407 _free_regions_at_end_of_collection = _g1->free_regions(); 407 _free_regions_at_end_of_collection = _g1->free_regions();
408 update_young_list_target_length(); 408 update_young_list_target_length();
409 _prev_eden_capacity = _young_list_target_length * HeapRegion::GrainBytes;
410 409
411 // We may immediately start allocating regions and placing them on the 410 // We may immediately start allocating regions and placing them on the
412 // collection set list. Initialize the per-collection set info 411 // collection set list. Initialize the per-collection set info
413 start_incremental_cset_building(); 412 start_incremental_cset_building();
414 } 413 }
744 } 743 }
745 #endif // PRODUCT 744 #endif // PRODUCT
746 745
747 void G1CollectorPolicy::record_full_collection_start() { 746 void G1CollectorPolicy::record_full_collection_start() {
748 _full_collection_start_sec = os::elapsedTime(); 747 _full_collection_start_sec = os::elapsedTime();
748 record_heap_size_info_at_start();
749 // Release the future to-space so that it is available for compaction into. 749 // Release the future to-space so that it is available for compaction into.
750 _g1->set_full_collection(); 750 _g1->set_full_collection();
751 } 751 }
752 752
753 void G1CollectorPolicy::record_full_collection_end() { 753 void G1CollectorPolicy::record_full_collection_end() {
786 786
787 void G1CollectorPolicy::record_stop_world_start() { 787 void G1CollectorPolicy::record_stop_world_start() {
788 _stop_world_start = os::elapsedTime(); 788 _stop_world_start = os::elapsedTime();
789 } 789 }
790 790
791 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, 791 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
792 size_t start_used) {
793 // We only need to do this here as the policy will only be applied 792 // We only need to do this here as the policy will only be applied
794 // to the GC we're about to start. so, no point is calculating this 793 // to the GC we're about to start. so, no point is calculating this
795 // every time we calculate / recalculate the target young length. 794 // every time we calculate / recalculate the target young length.
796 update_survivors_policy(); 795 update_survivors_policy();
797 796
801 800
802 double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; 801 double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
803 _trace_gen0_time_data.record_start_collection(s_w_t_ms); 802 _trace_gen0_time_data.record_start_collection(s_w_t_ms);
804 _stop_world_start = 0.0; 803 _stop_world_start = 0.0;
805 804
805 record_heap_size_info_at_start();
806
806 phase_times()->record_cur_collection_start_sec(start_time_sec); 807 phase_times()->record_cur_collection_start_sec(start_time_sec);
807 _cur_collection_pause_used_at_start_bytes = start_used;
808 _cur_collection_pause_used_regions_at_start = _g1->used_regions();
809 _pending_cards = _g1->pending_card_num(); 808 _pending_cards = _g1->pending_card_num();
810 809
811 _collection_set_bytes_used_before = 0; 810 _collection_set_bytes_used_before = 0;
812 _bytes_copied_during_gc = 0; 811 _bytes_copied_during_gc = 0;
813
814 YoungList* young_list = _g1->young_list();
815 _eden_bytes_before_gc = young_list->eden_used_bytes();
816 _survivor_bytes_before_gc = young_list->survivor_used_bytes();
817 _capacity_before_gc = _g1->capacity();
818 812
819 _last_gc_was_young = false; 813 _last_gc_was_young = false;
820 814
821 // do that for any other surv rate groups 815 // do that for any other surv rate groups
822 _short_lived_surv_rate_group->stop_adding_regions(); 816 _short_lived_surv_rate_group->stop_adding_regions();
1151 #define EXT_SIZE_FORMAT "%.1f%s" 1145 #define EXT_SIZE_FORMAT "%.1f%s"
1152 #define EXT_SIZE_PARAMS(bytes) \ 1146 #define EXT_SIZE_PARAMS(bytes) \
1153 byte_size_in_proper_unit((double)(bytes)), \ 1147 byte_size_in_proper_unit((double)(bytes)), \
1154 proper_unit_for_byte_size((bytes)) 1148 proper_unit_for_byte_size((bytes))
1155 1149
1150 void G1CollectorPolicy::record_heap_size_info_at_start() {
1151 YoungList* young_list = _g1->young_list();
1152 _eden_bytes_before_gc = young_list->eden_used_bytes();
1153 _survivor_bytes_before_gc = young_list->survivor_used_bytes();
1154 _capacity_before_gc = _g1->capacity();
1155
1156 _cur_collection_pause_used_at_start_bytes = _g1->used();
1157 _cur_collection_pause_used_regions_at_start = _g1->used_regions();
1158
1159 size_t eden_capacity_before_gc =
1160 (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_bytes_before_gc;
1161
1162 _prev_eden_capacity = eden_capacity_before_gc;
1163 }
1164
1156 void G1CollectorPolicy::print_heap_transition() { 1165 void G1CollectorPolicy::print_heap_transition() {
1157 _g1->print_size_transition(gclog_or_tty, 1166 _g1->print_size_transition(gclog_or_tty,
1158 _cur_collection_pause_used_at_start_bytes, _g1->used(), _g1->capacity()); 1167 _cur_collection_pause_used_at_start_bytes, _g1->used(), _g1->capacity());
1159 } 1168 }
1160 1169
1181 EXT_SIZE_PARAMS(survivor_bytes), 1190 EXT_SIZE_PARAMS(survivor_bytes),
1182 EXT_SIZE_PARAMS(used_before_gc), 1191 EXT_SIZE_PARAMS(used_before_gc),
1183 EXT_SIZE_PARAMS(_capacity_before_gc), 1192 EXT_SIZE_PARAMS(_capacity_before_gc),
1184 EXT_SIZE_PARAMS(used), 1193 EXT_SIZE_PARAMS(used),
1185 EXT_SIZE_PARAMS(capacity)); 1194 EXT_SIZE_PARAMS(capacity));
1186
1187 _prev_eden_capacity = eden_capacity;
1188 } 1195 }
1189 1196
1190 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time, 1197 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,
1191 double update_rs_processed_buffers, 1198 double update_rs_processed_buffers,
1192 double goal_ms) { 1199 double goal_ms) {