comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 6109:bbc900c2482a

7172279: G1: Clean up TraceGen0Time and TraceGen1Time data gathering Summary: Simplify code, remove unused code, remove ExitAfterGCNum Reviewed-by: huntch, johnc
author brutisso
date Thu, 31 May 2012 21:10:33 +0200
parents 9d679effd28c
children 922993931b3d
comparison
equal deleted inserted replaced
6108:c52a6a39546c 6109:bbc900c2482a
131 G1CollectorPolicy::G1CollectorPolicy() : 131 G1CollectorPolicy::G1CollectorPolicy() :
132 _parallel_gc_threads(G1CollectedHeap::use_parallel_gc_threads() 132 _parallel_gc_threads(G1CollectedHeap::use_parallel_gc_threads()
133 ? ParallelGCThreads : 1), 133 ? ParallelGCThreads : 1),
134 134
135 _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), 135 _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
136 _all_pause_times_ms(new NumberSeq()),
137 _stop_world_start(0.0), 136 _stop_world_start(0.0),
138 _all_stop_world_times_ms(new NumberSeq()),
139 _all_yield_times_ms(new NumberSeq()),
140
141 _summary(new Summary()),
142 137
143 _cur_clear_ct_time_ms(0.0), 138 _cur_clear_ct_time_ms(0.0),
144 _root_region_scan_wait_time_ms(0.0), 139 _root_region_scan_wait_time_ms(0.0),
145 140
146 _cur_ref_proc_time_ms(0.0), 141 _cur_ref_proc_time_ms(0.0),
151 _max_clear_cc_time_ms(-1.0), 146 _max_clear_cc_time_ms(-1.0),
152 _cur_clear_cc_time_ms(0.0), 147 _cur_clear_cc_time_ms(0.0),
153 _cum_clear_cc_time_ms(0.0), 148 _cum_clear_cc_time_ms(0.0),
154 _num_cc_clears(0L), 149 _num_cc_clears(0L),
155 #endif 150 #endif
156
157 _aux_num(10),
158 _all_aux_times_ms(new NumberSeq[_aux_num]),
159 _cur_aux_start_times_ms(new double[_aux_num]),
160 _cur_aux_times_ms(new double[_aux_num]),
161 _cur_aux_times_set(new bool[_aux_num]),
162 151
163 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), 152 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
164 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), 153 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
165 154
166 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 155 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
183 _rs_lengths_seq(new TruncatedSeq(TruncatedSeqLength)), 172 _rs_lengths_seq(new TruncatedSeq(TruncatedSeqLength)),
184 173
185 _pause_time_target_ms((double) MaxGCPauseMillis), 174 _pause_time_target_ms((double) MaxGCPauseMillis),
186 175
187 _gcs_are_young(true), 176 _gcs_are_young(true),
188 _young_pause_num(0),
189 _mixed_pause_num(0),
190 177
191 _during_marking(false), 178 _during_marking(false),
192 _in_marking_window(false), 179 _in_marking_window(false),
193 _in_marking_window_im(false), 180 _in_marking_window_im(false),
194 181
195 _recent_prev_end_times_for_all_gcs_sec( 182 _recent_prev_end_times_for_all_gcs_sec(
196 new TruncatedSeq(NumPrevPausesForHeuristics)), 183 new TruncatedSeq(NumPrevPausesForHeuristics)),
197 184
198 _recent_avg_pause_time_ratio(0.0), 185 _recent_avg_pause_time_ratio(0.0),
199
200 _all_full_gc_times_ms(new NumberSeq()),
201 186
202 _initiate_conc_mark_if_possible(false), 187 _initiate_conc_mark_if_possible(false),
203 _during_initial_mark_pause(false), 188 _during_initial_mark_pause(false),
204 _last_young_gc(false), 189 _last_young_gc(false),
205 _last_gc_was_young(false), 190 _last_gc_was_young(false),
849 // since last pause. 834 // since last pause.
850 double end_sec = os::elapsedTime(); 835 double end_sec = os::elapsedTime();
851 double full_gc_time_sec = end_sec - _cur_collection_start_sec; 836 double full_gc_time_sec = end_sec - _cur_collection_start_sec;
852 double full_gc_time_ms = full_gc_time_sec * 1000.0; 837 double full_gc_time_ms = full_gc_time_sec * 1000.0;
853 838
854 _all_full_gc_times_ms->add(full_gc_time_ms); 839 _trace_gen1_time_data.record_full_collection(full_gc_time_ms);
855 840
856 update_recent_gc_times(end_sec, full_gc_time_ms); 841 update_recent_gc_times(end_sec, full_gc_time_ms);
857 842
858 _g1->clear_full_collection(); 843 _g1->clear_full_collection();
859 844
898 assert(_g1->used() == _g1->recalculate_used(), 883 assert(_g1->used() == _g1->recalculate_used(),
899 err_msg("sanity, used: "SIZE_FORMAT" recalculate_used: "SIZE_FORMAT, 884 err_msg("sanity, used: "SIZE_FORMAT" recalculate_used: "SIZE_FORMAT,
900 _g1->used(), _g1->recalculate_used())); 885 _g1->used(), _g1->recalculate_used()));
901 886
902 double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; 887 double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
903 _all_stop_world_times_ms->add(s_w_t_ms); 888 _trace_gen0_time_data.record_start_collection(s_w_t_ms);
904 _stop_world_start = 0.0; 889 _stop_world_start = 0.0;
905 890
906 _cur_collection_start_sec = start_time_sec; 891 _cur_collection_start_sec = start_time_sec;
907 _cur_collection_pause_used_at_start_bytes = start_used; 892 _cur_collection_pause_used_at_start_bytes = start_used;
908 _cur_collection_pause_used_regions_at_start = _g1->used_regions(); 893 _cur_collection_pause_used_regions_at_start = _g1->used_regions();
935 _par_last_gc_worker_times_ms[i] = -1234.0; 920 _par_last_gc_worker_times_ms[i] = -1234.0;
936 _par_last_gc_worker_other_times_ms[i] = -1234.0; 921 _par_last_gc_worker_other_times_ms[i] = -1234.0;
937 } 922 }
938 #endif 923 #endif
939 924
940 for (int i = 0; i < _aux_num; ++i) {
941 _cur_aux_times_ms[i] = 0.0;
942 _cur_aux_times_set[i] = false;
943 }
944
945 // This is initialized to zero here and is set during the evacuation 925 // This is initialized to zero here and is set during the evacuation
946 // pause if we actually waited for the root region scanning to finish. 926 // pause if we actually waited for the root region scanning to finish.
947 _root_region_scan_wait_time_ms = 0.0; 927 _root_region_scan_wait_time_ms = 0.0;
948 928
949 _last_gc_was_young = false; 929 _last_gc_was_young = false;
988 } 968 }
989 969
990 void G1CollectorPolicy::record_concurrent_pause() { 970 void G1CollectorPolicy::record_concurrent_pause() {
991 if (_stop_world_start > 0.0) { 971 if (_stop_world_start > 0.0) {
992 double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; 972 double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0;
993 _all_yield_times_ms->add(yield_ms); 973 _trace_gen0_time_data.record_yield_time(yield_ms);
994 } 974 }
995 } 975 }
996 976
997 void G1CollectorPolicy::record_concurrent_pause_end() { 977 void G1CollectorPolicy::record_concurrent_pause_end() {
998 } 978 }
1195 } 1175 }
1196 1176
1197 _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0, 1177 _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0,
1198 end_time_sec, false); 1178 end_time_sec, false);
1199 1179
1200 // This assert is exempted when we're doing parallel collection pauses,
1201 // because the fragmentation caused by the parallel GC allocation buffers
1202 // can lead to more memory being used during collection than was used
1203 // before. Best leave this out until the fragmentation problem is fixed.
1204 // Pauses in which evacuation failed can also lead to negative
1205 // collections, since no space is reclaimed from a region containing an
1206 // object whose evacuation failed.
1207 // Further, we're now always doing parallel collection. But I'm still
1208 // leaving this here as a placeholder for a more precise assertion later.
1209 // (DLD, 10/05.)
1210 assert((true || parallel) // Always using GC LABs now.
1211 || _g1->evacuation_failed()
1212 || _cur_collection_pause_used_at_start_bytes >= cur_used_bytes,
1213 "Negative collection");
1214
1215 size_t freed_bytes = 1180 size_t freed_bytes =
1216 _cur_collection_pause_used_at_start_bytes - cur_used_bytes; 1181 _cur_collection_pause_used_at_start_bytes - cur_used_bytes;
1217 size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes; 1182 size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes;
1218 1183
1219 double survival_fraction = 1184 double survival_fraction =
1257 // Subtract the time taken to clean the card table from the 1222 // Subtract the time taken to clean the card table from the
1258 // current value of "other time" 1223 // current value of "other time"
1259 other_time_ms -= _cur_clear_ct_time_ms; 1224 other_time_ms -= _cur_clear_ct_time_ms;
1260 1225
1261 // TraceGen0Time and TraceGen1Time summary info updating. 1226 // TraceGen0Time and TraceGen1Time summary info updating.
1262 _all_pause_times_ms->add(elapsed_ms);
1263 1227
1264 if (update_stats) { 1228 if (update_stats) {
1265 _summary->record_total_time_ms(elapsed_ms); 1229 double parallel_known_time = known_time + termination_time;
1266 _summary->record_other_time_ms(other_time_ms); 1230 double parallel_other_time = _cur_collection_par_time_ms - parallel_known_time;
1267 1231
1268 MainBodySummary* body_summary = _summary->main_body_summary(); 1232 _trace_gen0_time_data.record_end_collection(
1269 assert(body_summary != NULL, "should not be null!"); 1233 elapsed_ms, other_time_ms, _root_region_scan_wait_time_ms, _cur_collection_par_time_ms,
1270 1234 ext_root_scan_time, satb_filtering_time, update_rs_time, scan_rs_time, obj_copy_time,
1271 body_summary->record_root_region_scan_wait_time_ms( 1235 termination_time, parallel_other_time, _cur_clear_ct_time_ms);
1272 _root_region_scan_wait_time_ms);
1273 body_summary->record_ext_root_scan_time_ms(ext_root_scan_time);
1274 body_summary->record_satb_filtering_time_ms(satb_filtering_time);
1275 body_summary->record_update_rs_time_ms(update_rs_time);
1276 body_summary->record_scan_rs_time_ms(scan_rs_time);
1277 body_summary->record_obj_copy_time_ms(obj_copy_time);
1278
1279 if (parallel) {
1280 body_summary->record_parallel_time_ms(_cur_collection_par_time_ms);
1281 body_summary->record_termination_time_ms(termination_time);
1282
1283 double parallel_known_time = known_time + termination_time;
1284 double parallel_other_time = _cur_collection_par_time_ms - parallel_known_time;
1285 body_summary->record_parallel_other_time_ms(parallel_other_time);
1286 }
1287
1288 body_summary->record_clear_ct_time_ms(_cur_clear_ct_time_ms);
1289
1290 // We exempt parallel collection from this check because Alloc Buffer
1291 // fragmentation can produce negative collections. Same with evac
1292 // failure.
1293 // Further, we're now always doing parallel collection. But I'm still
1294 // leaving this here as a placeholder for a more precise assertion later.
1295 // (DLD, 10/05.
1296 assert((true || parallel)
1297 || _g1->evacuation_failed()
1298 || surviving_bytes <= _collection_set_bytes_used_before,
1299 "Or else negative collection!");
1300 1236
1301 // this is where we update the allocation rate of the application 1237 // this is where we update the allocation rate of the application
1302 double app_time_ms = 1238 double app_time_ms =
1303 (_cur_collection_start_sec * 1000.0 - _prev_collection_pause_end_ms); 1239 (_cur_collection_start_sec * 1000.0 - _prev_collection_pause_end_ms);
1304 if (app_time_ms < MIN_TIMER_GRANULARITY) { 1240 if (app_time_ms < MIN_TIMER_GRANULARITY) {
1347 _recent_avg_pause_time_ratio = 1.0; 1283 _recent_avg_pause_time_ratio = 1.0;
1348 } 1284 }
1349 } 1285 }
1350 } 1286 }
1351 1287
1352 for (int i = 0; i < _aux_num; ++i) {
1353 if (_cur_aux_times_set[i]) {
1354 _all_aux_times_ms[i].add(_cur_aux_times_ms[i]);
1355 }
1356 }
1357
1358 if (G1Log::finer()) { 1288 if (G1Log::finer()) {
1359 bool print_marking_info = 1289 bool print_marking_info =
1360 _g1->mark_in_progress() && !last_pause_included_initial_mark; 1290 _g1->mark_in_progress() && !last_pause_included_initial_mark;
1361 1291
1362 gclog_or_tty->print_cr("%s, %1.8lf secs]", 1292 gclog_or_tty->print_cr("%s, %1.8lf secs]",
1434 print_stats(2, "Ref Proc", _cur_ref_proc_time_ms); 1364 print_stats(2, "Ref Proc", _cur_ref_proc_time_ms);
1435 print_stats(2, "Ref Enq", _cur_ref_enq_time_ms); 1365 print_stats(2, "Ref Enq", _cur_ref_enq_time_ms);
1436 print_stats(2, "Free CSet", 1366 print_stats(2, "Free CSet",
1437 (_recorded_young_free_cset_time_ms + 1367 (_recorded_young_free_cset_time_ms +
1438 _recorded_non_young_free_cset_time_ms)); 1368 _recorded_non_young_free_cset_time_ms));
1439
1440 for (int i = 0; i < _aux_num; ++i) {
1441 if (_cur_aux_times_set[i]) {
1442 char buffer[96];
1443 sprintf(buffer, "Aux%d", i);
1444 print_stats(1, buffer, _cur_aux_times_ms[i]);
1445 }
1446 }
1447 } 1369 }
1448 1370
1449 bool new_in_marking_window = _in_marking_window; 1371 bool new_in_marking_window = _in_marking_window;
1450 bool new_in_marking_window_im = false; 1372 bool new_in_marking_window_im = false;
1451 if (during_initial_mark_pause()) { 1373 if (during_initial_mark_pause()) {
1806 void G1CollectorPolicy::count_CS_bytes_used() { 1728 void G1CollectorPolicy::count_CS_bytes_used() {
1807 CountCSClosure cs_closure(this); 1729 CountCSClosure cs_closure(this);
1808 _g1->collection_set_iterate(&cs_closure); 1730 _g1->collection_set_iterate(&cs_closure);
1809 } 1731 }
1810 1732
1811 void G1CollectorPolicy::print_summary(int level,
1812 const char* str,
1813 NumberSeq* seq) const {
1814 double sum = seq->sum();
1815 LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)",
1816 str, sum / 1000.0, seq->avg());
1817 }
1818
1819 void G1CollectorPolicy::print_summary_sd(int level,
1820 const char* str,
1821 NumberSeq* seq) const {
1822 print_summary(level, str, seq);
1823 LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
1824 seq->num(), seq->sd(), seq->maximum());
1825 }
1826
1827 void G1CollectorPolicy::check_other_times(int level,
1828 NumberSeq* other_times_ms,
1829 NumberSeq* calc_other_times_ms) const {
1830 bool should_print = false;
1831 LineBuffer buf(level + 2);
1832
1833 double max_sum = MAX2(fabs(other_times_ms->sum()),
1834 fabs(calc_other_times_ms->sum()));
1835 double min_sum = MIN2(fabs(other_times_ms->sum()),
1836 fabs(calc_other_times_ms->sum()));
1837 double sum_ratio = max_sum / min_sum;
1838 if (sum_ratio > 1.1) {
1839 should_print = true;
1840 buf.append_and_print_cr("## CALCULATED OTHER SUM DOESN'T MATCH RECORDED ###");
1841 }
1842
1843 double max_avg = MAX2(fabs(other_times_ms->avg()),
1844 fabs(calc_other_times_ms->avg()));
1845 double min_avg = MIN2(fabs(other_times_ms->avg()),
1846 fabs(calc_other_times_ms->avg()));
1847 double avg_ratio = max_avg / min_avg;
1848 if (avg_ratio > 1.1) {
1849 should_print = true;
1850 buf.append_and_print_cr("## CALCULATED OTHER AVG DOESN'T MATCH RECORDED ###");
1851 }
1852
1853 if (other_times_ms->sum() < -0.01) {
1854 buf.append_and_print_cr("## RECORDED OTHER SUM IS NEGATIVE ###");
1855 }
1856
1857 if (other_times_ms->avg() < -0.01) {
1858 buf.append_and_print_cr("## RECORDED OTHER AVG IS NEGATIVE ###");
1859 }
1860
1861 if (calc_other_times_ms->sum() < -0.01) {
1862 should_print = true;
1863 buf.append_and_print_cr("## CALCULATED OTHER SUM IS NEGATIVE ###");
1864 }
1865
1866 if (calc_other_times_ms->avg() < -0.01) {
1867 should_print = true;
1868 buf.append_and_print_cr("## CALCULATED OTHER AVG IS NEGATIVE ###");
1869 }
1870
1871 if (should_print)
1872 print_summary(level, "Other(Calc)", calc_other_times_ms);
1873 }
1874
1875 void G1CollectorPolicy::print_summary(PauseSummary* summary) const {
1876 bool parallel = G1CollectedHeap::use_parallel_gc_threads();
1877 MainBodySummary* body_summary = summary->main_body_summary();
1878 if (summary->get_total_seq()->num() > 0) {
1879 print_summary_sd(0, "Evacuation Pauses", summary->get_total_seq());
1880 if (body_summary != NULL) {
1881 print_summary(1, "Root Region Scan Wait", body_summary->get_root_region_scan_wait_seq());
1882 if (parallel) {
1883 print_summary(1, "Parallel Time", body_summary->get_parallel_seq());
1884 print_summary(2, "Ext Root Scanning", body_summary->get_ext_root_scan_seq());
1885 print_summary(2, "SATB Filtering", body_summary->get_satb_filtering_seq());
1886 print_summary(2, "Update RS", body_summary->get_update_rs_seq());
1887 print_summary(2, "Scan RS", body_summary->get_scan_rs_seq());
1888 print_summary(2, "Object Copy", body_summary->get_obj_copy_seq());
1889 print_summary(2, "Termination", body_summary->get_termination_seq());
1890 print_summary(2, "Parallel Other", body_summary->get_parallel_other_seq());
1891 {
1892 NumberSeq* other_parts[] = {
1893 body_summary->get_ext_root_scan_seq(),
1894 body_summary->get_satb_filtering_seq(),
1895 body_summary->get_update_rs_seq(),
1896 body_summary->get_scan_rs_seq(),
1897 body_summary->get_obj_copy_seq(),
1898 body_summary->get_termination_seq()
1899 };
1900 NumberSeq calc_other_times_ms(body_summary->get_parallel_seq(),
1901 6, other_parts);
1902 check_other_times(2, body_summary->get_parallel_other_seq(),
1903 &calc_other_times_ms);
1904 }
1905 } else {
1906 print_summary(1, "Ext Root Scanning", body_summary->get_ext_root_scan_seq());
1907 print_summary(1, "SATB Filtering", body_summary->get_satb_filtering_seq());
1908 print_summary(1, "Update RS", body_summary->get_update_rs_seq());
1909 print_summary(1, "Scan RS", body_summary->get_scan_rs_seq());
1910 print_summary(1, "Object Copy", body_summary->get_obj_copy_seq());
1911 }
1912 }
1913 print_summary(1, "Clear CT", body_summary->get_clear_ct_seq());
1914 print_summary(1, "Other", summary->get_other_seq());
1915 {
1916 if (body_summary != NULL) {
1917 NumberSeq calc_other_times_ms;
1918 if (parallel) {
1919 // parallel
1920 NumberSeq* other_parts[] = {
1921 body_summary->get_root_region_scan_wait_seq(),
1922 body_summary->get_parallel_seq(),
1923 body_summary->get_clear_ct_seq()
1924 };
1925 calc_other_times_ms = NumberSeq(summary->get_total_seq(),
1926 3, other_parts);
1927 } else {
1928 // serial
1929 NumberSeq* other_parts[] = {
1930 body_summary->get_root_region_scan_wait_seq(),
1931 body_summary->get_update_rs_seq(),
1932 body_summary->get_ext_root_scan_seq(),
1933 body_summary->get_satb_filtering_seq(),
1934 body_summary->get_scan_rs_seq(),
1935 body_summary->get_obj_copy_seq()
1936 };
1937 calc_other_times_ms = NumberSeq(summary->get_total_seq(),
1938 6, other_parts);
1939 }
1940 check_other_times(1, summary->get_other_seq(), &calc_other_times_ms);
1941 }
1942 }
1943 } else {
1944 LineBuffer(1).append_and_print_cr("none");
1945 }
1946 LineBuffer(0).append_and_print_cr("");
1947 }
1948
1949 void G1CollectorPolicy::print_tracing_info() const { 1733 void G1CollectorPolicy::print_tracing_info() const {
1950 if (TraceGen0Time) { 1734 _trace_gen0_time_data.print();
1951 gclog_or_tty->print_cr("ALL PAUSES"); 1735 _trace_gen1_time_data.print();
1952 print_summary_sd(0, "Total", _all_pause_times_ms);
1953 gclog_or_tty->print_cr("");
1954 gclog_or_tty->print_cr("");
1955 gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num);
1956 gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num);
1957 gclog_or_tty->print_cr("");
1958
1959 gclog_or_tty->print_cr("EVACUATION PAUSES");
1960 print_summary(_summary);
1961
1962 gclog_or_tty->print_cr("MISC");
1963 print_summary_sd(0, "Stop World", _all_stop_world_times_ms);
1964 print_summary_sd(0, "Yields", _all_yield_times_ms);
1965 for (int i = 0; i < _aux_num; ++i) {
1966 if (_all_aux_times_ms[i].num() > 0) {
1967 char buffer[96];
1968 sprintf(buffer, "Aux%d", i);
1969 print_summary_sd(0, buffer, &_all_aux_times_ms[i]);
1970 }
1971 }
1972 }
1973 if (TraceGen1Time) {
1974 if (_all_full_gc_times_ms->num() > 0) {
1975 gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s",
1976 _all_full_gc_times_ms->num(),
1977 _all_full_gc_times_ms->sum() / 1000.0);
1978 gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times_ms->avg());
1979 gclog_or_tty->print_cr(" [std. dev = %8.2f ms, max = %8.2f ms]",
1980 _all_full_gc_times_ms->sd(),
1981 _all_full_gc_times_ms->maximum());
1982 }
1983 }
1984 } 1736 }
1985 1737
1986 void G1CollectorPolicy::print_yg_surv_rate_info() const { 1738 void G1CollectorPolicy::print_yg_surv_rate_info() const {
1987 #ifndef PRODUCT 1739 #ifndef PRODUCT
1988 _short_lived_surv_rate_group->print_surv_rate_summary(); 1740 _short_lived_surv_rate_group->print_surv_rate_summary();
2529 2281
2530 _collection_set_bytes_used_before = 0; 2282 _collection_set_bytes_used_before = 0;
2531 _last_gc_was_young = gcs_are_young() ? true : false; 2283 _last_gc_was_young = gcs_are_young() ? true : false;
2532 2284
2533 if (_last_gc_was_young) { 2285 if (_last_gc_was_young) {
2534 ++_young_pause_num; 2286 _trace_gen0_time_data.increment_young_collection_count();
2535 } else { 2287 } else {
2536 ++_mixed_pause_num; 2288 _trace_gen0_time_data.increment_mixed_collection_count();
2537 } 2289 }
2538 2290
2539 // The young list is laid with the survivor regions from the previous 2291 // The young list is laid with the survivor regions from the previous
2540 // pause are appended to the RHS of the young list, i.e. 2292 // pause are appended to the RHS of the young list, i.e.
2541 // [Newly Young Regions ++ Survivors from last pause]. 2293 // [Newly Young Regions ++ Survivors from last pause].
2688 2440
2689 double non_young_end_time_sec = os::elapsedTime(); 2441 double non_young_end_time_sec = os::elapsedTime();
2690 _recorded_non_young_cset_choice_time_ms = 2442 _recorded_non_young_cset_choice_time_ms =
2691 (non_young_end_time_sec - non_young_start_time_sec) * 1000.0; 2443 (non_young_end_time_sec - non_young_start_time_sec) * 1000.0;
2692 } 2444 }
2445
2446 void TraceGen0TimeData::record_start_collection(double time_to_stop_the_world_ms) {
2447 if(TraceGen0Time) {
2448 _all_stop_world_times_ms.add(time_to_stop_the_world_ms);
2449 }
2450 }
2451
2452 void TraceGen0TimeData::record_yield_time(double yield_time_ms) {
2453 if(TraceGen0Time) {
2454 _all_yield_times_ms.add(yield_time_ms);
2455 }
2456 }
2457
2458 void TraceGen0TimeData::record_end_collection(
2459 double total_ms,
2460 double other_ms,
2461 double root_region_scan_wait_ms,
2462 double parallel_ms,
2463 double ext_root_scan_ms,
2464 double satb_filtering_ms,
2465 double update_rs_ms,
2466 double scan_rs_ms,
2467 double obj_copy_ms,
2468 double termination_ms,
2469 double parallel_other_ms,
2470 double clear_ct_ms)
2471 {
2472 if(TraceGen0Time) {
2473 _total.add(total_ms);
2474 _other.add(other_ms);
2475 _root_region_scan_wait.add(root_region_scan_wait_ms);
2476 _parallel.add(parallel_ms);
2477 _ext_root_scan.add(ext_root_scan_ms);
2478 _satb_filtering.add(satb_filtering_ms);
2479 _update_rs.add(update_rs_ms);
2480 _scan_rs.add(scan_rs_ms);
2481 _obj_copy.add(obj_copy_ms);
2482 _termination.add(termination_ms);
2483 _parallel_other.add(parallel_other_ms);
2484 _clear_ct.add(clear_ct_ms);
2485 }
2486 }
2487
2488 void TraceGen0TimeData::increment_young_collection_count() {
2489 if(TraceGen0Time) {
2490 ++_young_pause_num;
2491 }
2492 }
2493
2494 void TraceGen0TimeData::increment_mixed_collection_count() {
2495 if(TraceGen0Time) {
2496 ++_mixed_pause_num;
2497 }
2498 }
2499
2500 void TraceGen0TimeData::print_summary(int level,
2501 const char* str,
2502 const NumberSeq* seq) const {
2503 double sum = seq->sum();
2504 LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)",
2505 str, sum / 1000.0, seq->avg());
2506 }
2507
2508 void TraceGen0TimeData::print_summary_sd(int level,
2509 const char* str,
2510 const NumberSeq* seq) const {
2511 print_summary(level, str, seq);
2512 LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
2513 seq->num(), seq->sd(), seq->maximum());
2514 }
2515
2516 void TraceGen0TimeData::print() const {
2517 if (!TraceGen0Time) {
2518 return;
2519 }
2520
2521 gclog_or_tty->print_cr("ALL PAUSES");
2522 print_summary_sd(0, "Total", &_total);
2523 gclog_or_tty->print_cr("");
2524 gclog_or_tty->print_cr("");
2525 gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num);
2526 gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num);
2527 gclog_or_tty->print_cr("");
2528
2529 gclog_or_tty->print_cr("EVACUATION PAUSES");
2530
2531 if (_young_pause_num == 0 && _mixed_pause_num == 0) {
2532 gclog_or_tty->print_cr("none");
2533 } else {
2534 print_summary_sd(0, "Evacuation Pauses", &_total);
2535 print_summary(1, "Root Region Scan Wait", &_root_region_scan_wait);
2536 print_summary(1, "Parallel Time", &_parallel);
2537 print_summary(2, "Ext Root Scanning", &_ext_root_scan);
2538 print_summary(2, "SATB Filtering", &_satb_filtering);
2539 print_summary(2, "Update RS", &_update_rs);
2540 print_summary(2, "Scan RS", &_scan_rs);
2541 print_summary(2, "Object Copy", &_obj_copy);
2542 print_summary(2, "Termination", &_termination);
2543 print_summary(2, "Parallel Other", &_parallel_other);
2544 print_summary(1, "Clear CT", &_clear_ct);
2545 print_summary(1, "Other", &_other);
2546 }
2547 gclog_or_tty->print_cr("");
2548
2549 gclog_or_tty->print_cr("MISC");
2550 print_summary_sd(0, "Stop World", &_all_stop_world_times_ms);
2551 print_summary_sd(0, "Yields", &_all_yield_times_ms);
2552 }
2553
2554 void TraceGen1TimeData::record_full_collection(double full_gc_time_ms) {
2555 if (TraceGen1Time) {
2556 _all_full_gc_times.add(full_gc_time_ms);
2557 }
2558 }
2559
2560 void TraceGen1TimeData::print() const {
2561 if (!TraceGen1Time) {
2562 return;
2563 }
2564
2565 if (_all_full_gc_times.num() > 0) {
2566 gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s",
2567 _all_full_gc_times.num(),
2568 _all_full_gc_times.sum() / 1000.0);
2569 gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times.avg());
2570 gclog_or_tty->print_cr(" [std. dev = %8.2f ms, max = %8.2f ms]",
2571 _all_full_gc_times.sd(),
2572 _all_full_gc_times.maximum());
2573 }
2574 }