3970 return queues()->queue(i); |
3970 return queues()->queue(i); |
3971 } |
3971 } |
3972 |
3972 |
3973 void work(int i) { |
3973 void work(int i) { |
3974 if (i >= _n_workers) return; // no work needed this round |
3974 if (i >= _n_workers) return; // no work needed this round |
|
3975 |
|
3976 double start_time_ms = os::elapsedTime() * 1000.0; |
|
3977 _g1h->g1_policy()->record_gc_worker_start_time(i, start_time_ms); |
|
3978 |
3975 ResourceMark rm; |
3979 ResourceMark rm; |
3976 HandleMark hm; |
3980 HandleMark hm; |
3977 |
3981 |
3978 G1ParScanThreadState pss(_g1h, i); |
3982 G1ParScanThreadState pss(_g1h, i); |
3979 G1ParScanHeapEvacClosure scan_evac_cl(_g1h, &pss); |
3983 G1ParScanHeapEvacClosure scan_evac_cl(_g1h, &pss); |
4017 G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator); |
4021 G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator); |
4018 evac.do_void(); |
4022 evac.do_void(); |
4019 double elapsed_ms = (os::elapsedTime()-start)*1000.0; |
4023 double elapsed_ms = (os::elapsedTime()-start)*1000.0; |
4020 double term_ms = pss.term_time()*1000.0; |
4024 double term_ms = pss.term_time()*1000.0; |
4021 _g1h->g1_policy()->record_obj_copy_time(i, elapsed_ms-term_ms); |
4025 _g1h->g1_policy()->record_obj_copy_time(i, elapsed_ms-term_ms); |
4022 _g1h->g1_policy()->record_termination_time(i, term_ms); |
4026 _g1h->g1_policy()->record_termination(i, term_ms, pss.term_attempts()); |
4023 } |
4027 } |
4024 _g1h->g1_policy()->record_thread_age_table(pss.age_table()); |
4028 _g1h->g1_policy()->record_thread_age_table(pss.age_table()); |
4025 _g1h->update_surviving_young_words(pss.surviving_young_words()+1); |
4029 _g1h->update_surviving_young_words(pss.surviving_young_words()+1); |
4026 |
4030 |
4027 // Clean up any par-expanded rem sets. |
4031 // Clean up any par-expanded rem sets. |
4041 double elapsed = pss.elapsed(); |
4045 double elapsed = pss.elapsed(); |
4042 double strong_roots = pss.strong_roots_time(); |
4046 double strong_roots = pss.strong_roots_time(); |
4043 double term = pss.term_time(); |
4047 double term = pss.term_time(); |
4044 gclog_or_tty->print(" Elapsed: %7.2f ms.\n" |
4048 gclog_or_tty->print(" Elapsed: %7.2f ms.\n" |
4045 " Strong roots: %7.2f ms (%6.2f%%)\n" |
4049 " Strong roots: %7.2f ms (%6.2f%%)\n" |
4046 " Termination: %7.2f ms (%6.2f%%) (in %d entries)\n", |
4050 " Termination: %7.2f ms (%6.2f%%) " |
|
4051 "(in "SIZE_FORMAT" entries)\n", |
4047 elapsed * 1000.0, |
4052 elapsed * 1000.0, |
4048 strong_roots * 1000.0, (strong_roots*100.0/elapsed), |
4053 strong_roots * 1000.0, (strong_roots*100.0/elapsed), |
4049 term * 1000.0, (term*100.0/elapsed), |
4054 term * 1000.0, (term*100.0/elapsed), |
4050 pss.term_attempts()); |
4055 pss.term_attempts()); |
4051 size_t total_waste = pss.alloc_buffer_waste() + pss.undo_waste(); |
4056 size_t total_waste = pss.alloc_buffer_waste() + pss.undo_waste(); |
4057 (pss.undo_waste() * HeapWordSize) / K); |
4062 (pss.undo_waste() * HeapWordSize) / K); |
4058 } |
4063 } |
4059 |
4064 |
4060 assert(pss.refs_to_scan() == 0, "Task queue should be empty"); |
4065 assert(pss.refs_to_scan() == 0, "Task queue should be empty"); |
4061 assert(pss.overflowed_refs_to_scan() == 0, "Overflow queue should be empty"); |
4066 assert(pss.overflowed_refs_to_scan() == 0, "Overflow queue should be empty"); |
|
4067 double end_time_ms = os::elapsedTime() * 1000.0; |
|
4068 _g1h->g1_policy()->record_gc_worker_end_time(i, end_time_ms); |
4062 } |
4069 } |
4063 }; |
4070 }; |
4064 |
4071 |
4065 // *** Common G1 Evacuation Stuff |
4072 // *** Common G1 Evacuation Stuff |
4066 |
4073 |