comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 10291:48391ab0687e

8010738: G1: Output for full GCs with +PrintGCDetails should contain perm gen size/meta data change info Summary: Include metaspace information (used, allocated, reserved) in the PrintGCDetails output for full GCs. Reviewed-by: poonam, jmasa, brutisso
author johnc
date Thu, 16 May 2013 09:24:26 -0700
parents f14063dcd52a
children f2110083203d
comparison
equal deleted inserted replaced
10290:05a17f270c7e 10291:48391ab0687e
122 _initiate_conc_mark_if_possible(false), 122 _initiate_conc_mark_if_possible(false),
123 _during_initial_mark_pause(false), 123 _during_initial_mark_pause(false),
124 _last_young_gc(false), 124 _last_young_gc(false),
125 _last_gc_was_young(false), 125 _last_gc_was_young(false),
126 126
127 _eden_bytes_before_gc(0), 127 _eden_used_bytes_before_gc(0),
128 _survivor_bytes_before_gc(0), 128 _survivor_used_bytes_before_gc(0),
129 _capacity_before_gc(0), 129 _heap_used_bytes_before_gc(0),
130 _metaspace_used_bytes_before_gc(0),
131 _eden_capacity_bytes_before_gc(0),
132 _heap_capacity_bytes_before_gc(0),
130 133
131 _eden_cset_region_length(0), 134 _eden_cset_region_length(0),
132 _survivor_cset_region_length(0), 135 _survivor_cset_region_length(0),
133 _old_cset_region_length(0), 136 _old_cset_region_length(0),
134 137
744 } 747 }
745 #endif // PRODUCT 748 #endif // PRODUCT
746 749
747 void G1CollectorPolicy::record_full_collection_start() { 750 void G1CollectorPolicy::record_full_collection_start() {
748 _full_collection_start_sec = os::elapsedTime(); 751 _full_collection_start_sec = os::elapsedTime();
749 record_heap_size_info_at_start(); 752 record_heap_size_info_at_start(true /* full */);
750 // Release the future to-space so that it is available for compaction into. 753 // Release the future to-space so that it is available for compaction into.
751 _g1->set_full_collection(); 754 _g1->set_full_collection();
752 } 755 }
753 756
754 void G1CollectorPolicy::record_full_collection_end() { 757 void G1CollectorPolicy::record_full_collection_end() {
801 804
802 double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; 805 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); 806 _trace_gen0_time_data.record_start_collection(s_w_t_ms);
804 _stop_world_start = 0.0; 807 _stop_world_start = 0.0;
805 808
806 record_heap_size_info_at_start(); 809 record_heap_size_info_at_start(false /* full */);
807 810
808 phase_times()->record_cur_collection_start_sec(start_time_sec); 811 phase_times()->record_cur_collection_start_sec(start_time_sec);
809 _pending_cards = _g1->pending_card_num(); 812 _pending_cards = _g1->pending_card_num();
810 813
811 _collection_set_bytes_used_before = 0; 814 _collection_set_bytes_used_before = 0;
936 } 939 }
937 940
938 _mmu_tracker->add_pause(end_time_sec - pause_time_ms/1000.0, 941 _mmu_tracker->add_pause(end_time_sec - pause_time_ms/1000.0,
939 end_time_sec, false); 942 end_time_sec, false);
940 943
941 size_t freed_bytes =
942 _cur_collection_pause_used_at_start_bytes - cur_used_bytes;
943 size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes;
944
945 double survival_fraction =
946 (double)surviving_bytes/
947 (double)_collection_set_bytes_used_before;
948
949 if (update_stats) { 944 if (update_stats) {
950 _trace_gen0_time_data.record_end_collection(pause_time_ms, phase_times()); 945 _trace_gen0_time_data.record_end_collection(pause_time_ms, phase_times());
951 // this is where we update the allocation rate of the application 946 // this is where we update the allocation rate of the application
952 double app_time_ms = 947 double app_time_ms =
953 (phase_times()->cur_collection_start_sec() * 1000.0 - _prev_collection_pause_end_ms); 948 (phase_times()->cur_collection_start_sec() * 1000.0 - _prev_collection_pause_end_ms);
996 assert(_recent_avg_pause_time_ratio - 1.0 > 0.0, "Ctl-point invariant"); 991 assert(_recent_avg_pause_time_ratio - 1.0 > 0.0, "Ctl-point invariant");
997 _recent_avg_pause_time_ratio = 1.0; 992 _recent_avg_pause_time_ratio = 1.0;
998 } 993 }
999 } 994 }
1000 } 995 }
996
1001 bool new_in_marking_window = _in_marking_window; 997 bool new_in_marking_window = _in_marking_window;
1002 bool new_in_marking_window_im = false; 998 bool new_in_marking_window_im = false;
1003 if (during_initial_mark_pause()) { 999 if (during_initial_mark_pause()) {
1004 new_in_marking_window = true; 1000 new_in_marking_window = true;
1005 new_in_marking_window_im = true; 1001 new_in_marking_window_im = true;
1081 if (_max_rs_lengths > _recorded_rs_lengths) { 1077 if (_max_rs_lengths > _recorded_rs_lengths) {
1082 rs_length_diff = _max_rs_lengths - _recorded_rs_lengths; 1078 rs_length_diff = _max_rs_lengths - _recorded_rs_lengths;
1083 } 1079 }
1084 _rs_length_diff_seq->add((double) rs_length_diff); 1080 _rs_length_diff_seq->add((double) rs_length_diff);
1085 1081
1086 size_t copied_bytes = surviving_bytes; 1082 size_t freed_bytes = _heap_used_bytes_before_gc - cur_used_bytes;
1083 size_t copied_bytes = _collection_set_bytes_used_before - freed_bytes;
1087 double cost_per_byte_ms = 0.0; 1084 double cost_per_byte_ms = 0.0;
1085
1088 if (copied_bytes > 0) { 1086 if (copied_bytes > 0) {
1089 cost_per_byte_ms = phase_times()->average_last_obj_copy_time() / (double) copied_bytes; 1087 cost_per_byte_ms = phase_times()->average_last_obj_copy_time() / (double) copied_bytes;
1090 if (_in_marking_window) { 1088 if (_in_marking_window) {
1091 _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); 1089 _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
1092 } else { 1090 } else {
1146 #define EXT_SIZE_FORMAT "%.1f%s" 1144 #define EXT_SIZE_FORMAT "%.1f%s"
1147 #define EXT_SIZE_PARAMS(bytes) \ 1145 #define EXT_SIZE_PARAMS(bytes) \
1148 byte_size_in_proper_unit((double)(bytes)), \ 1146 byte_size_in_proper_unit((double)(bytes)), \
1149 proper_unit_for_byte_size((bytes)) 1147 proper_unit_for_byte_size((bytes))
1150 1148
1151 void G1CollectorPolicy::record_heap_size_info_at_start() { 1149 void G1CollectorPolicy::record_heap_size_info_at_start(bool full) {
1152 YoungList* young_list = _g1->young_list(); 1150 YoungList* young_list = _g1->young_list();
1153 _eden_bytes_before_gc = young_list->eden_used_bytes(); 1151 _eden_used_bytes_before_gc = young_list->eden_used_bytes();
1154 _survivor_bytes_before_gc = young_list->survivor_used_bytes(); 1152 _survivor_used_bytes_before_gc = young_list->survivor_used_bytes();
1155 _capacity_before_gc = _g1->capacity(); 1153 _heap_capacity_bytes_before_gc = _g1->capacity();
1156 1154 _heap_used_bytes_before_gc = _g1->used();
1157 _cur_collection_pause_used_at_start_bytes = _g1->used();
1158 _cur_collection_pause_used_regions_at_start = _g1->used_regions(); 1155 _cur_collection_pause_used_regions_at_start = _g1->used_regions();
1159 1156
1160 size_t eden_capacity_before_gc = 1157 _eden_capacity_bytes_before_gc =
1161 (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_bytes_before_gc; 1158 (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_used_bytes_before_gc;
1162 1159
1163 _prev_eden_capacity = eden_capacity_before_gc; 1160 if (full) {
1161 _metaspace_used_bytes_before_gc = MetaspaceAux::allocated_used_bytes();
1162 }
1164 } 1163 }
1165 1164
1166 void G1CollectorPolicy::print_heap_transition() { 1165 void G1CollectorPolicy::print_heap_transition() {
1167 _g1->print_size_transition(gclog_or_tty, 1166 _g1->print_size_transition(gclog_or_tty,
1168 _cur_collection_pause_used_at_start_bytes, _g1->used(), _g1->capacity()); 1167 _heap_used_bytes_before_gc,
1169 } 1168 _g1->used(),
1170 1169 _g1->capacity());
1171 void G1CollectorPolicy::print_detailed_heap_transition() { 1170 }
1172 YoungList* young_list = _g1->young_list(); 1171
1173 size_t eden_bytes = young_list->eden_used_bytes(); 1172 void G1CollectorPolicy::print_detailed_heap_transition(bool full) {
1174 size_t survivor_bytes = young_list->survivor_used_bytes(); 1173 YoungList* young_list = _g1->young_list();
1175 size_t used_before_gc = _cur_collection_pause_used_at_start_bytes; 1174
1176 size_t used = _g1->used(); 1175 size_t eden_used_bytes_after_gc = young_list->eden_used_bytes();
1177 size_t capacity = _g1->capacity(); 1176 size_t survivor_used_bytes_after_gc = young_list->survivor_used_bytes();
1178 size_t eden_capacity = 1177 size_t heap_used_bytes_after_gc = _g1->used();
1179 (_young_list_target_length * HeapRegion::GrainBytes) - survivor_bytes; 1178
1180 1179 size_t heap_capacity_bytes_after_gc = _g1->capacity();
1181 gclog_or_tty->print_cr( 1180 size_t eden_capacity_bytes_after_gc =
1182 " [Eden: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT") " 1181 (_young_list_target_length * HeapRegion::GrainBytes) - survivor_used_bytes_after_gc;
1183 "Survivors: "EXT_SIZE_FORMAT"->"EXT_SIZE_FORMAT" " 1182
1184 "Heap: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->" 1183 gclog_or_tty->print(
1185 EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")]", 1184 " [Eden: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT") "
1186 EXT_SIZE_PARAMS(_eden_bytes_before_gc), 1185 "Survivors: "EXT_SIZE_FORMAT"->"EXT_SIZE_FORMAT" "
1187 EXT_SIZE_PARAMS(_prev_eden_capacity), 1186 "Heap: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"
1188 EXT_SIZE_PARAMS(eden_bytes), 1187 EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")]",
1189 EXT_SIZE_PARAMS(eden_capacity), 1188 EXT_SIZE_PARAMS(_eden_used_bytes_before_gc),
1190 EXT_SIZE_PARAMS(_survivor_bytes_before_gc), 1189 EXT_SIZE_PARAMS(_eden_capacity_bytes_before_gc),
1191 EXT_SIZE_PARAMS(survivor_bytes), 1190 EXT_SIZE_PARAMS(eden_used_bytes_after_gc),
1192 EXT_SIZE_PARAMS(used_before_gc), 1191 EXT_SIZE_PARAMS(eden_capacity_bytes_after_gc),
1193 EXT_SIZE_PARAMS(_capacity_before_gc), 1192 EXT_SIZE_PARAMS(_survivor_used_bytes_before_gc),
1194 EXT_SIZE_PARAMS(used), 1193 EXT_SIZE_PARAMS(survivor_used_bytes_after_gc),
1195 EXT_SIZE_PARAMS(capacity)); 1194 EXT_SIZE_PARAMS(_heap_used_bytes_before_gc),
1195 EXT_SIZE_PARAMS(_heap_capacity_bytes_before_gc),
1196 EXT_SIZE_PARAMS(heap_used_bytes_after_gc),
1197 EXT_SIZE_PARAMS(heap_capacity_bytes_after_gc));
1198
1199 if (full) {
1200 MetaspaceAux::print_metaspace_change(_metaspace_used_bytes_before_gc);
1201 }
1202
1203 gclog_or_tty->cr();
1196 } 1204 }
1197 1205
1198 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time, 1206 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,
1199 double update_rs_processed_buffers, 1207 double update_rs_processed_buffers,
1200 double goal_ms) { 1208 double goal_ms) {