comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 20190:0982ec23da03

8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps Reviewed-by: jwilhelm, ehelin, tschatzl
author brutisso
date Thu, 19 Jun 2014 13:31:14 +0200
parents 8a140676873f
children 581e70386ec9
comparison
equal deleted inserted replaced
20189:5d855d021755 20190:0982ec23da03
508 _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)), 508 _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)),
509 509
510 _has_overflown(false), 510 _has_overflown(false),
511 _concurrent(false), 511 _concurrent(false),
512 _has_aborted(false), 512 _has_aborted(false),
513 _aborted_gc_id(GCId::undefined()),
513 _restart_for_overflow(false), 514 _restart_for_overflow(false),
514 _concurrent_marking_in_progress(false), 515 _concurrent_marking_in_progress(false),
515 516
516 // _verbose_level set below 517 // _verbose_level set below
517 518
1017 // marking. 1018 // marking.
1018 reset_marking_state(true /* clear_overflow */); 1019 reset_marking_state(true /* clear_overflow */);
1019 force_overflow()->update(); 1020 force_overflow()->update();
1020 1021
1021 if (G1Log::fine()) { 1022 if (G1Log::fine()) {
1022 gclog_or_tty->date_stamp(PrintGCDateStamps); 1023 gclog_or_tty->gclog_stamp(concurrent_gc_id());
1023 gclog_or_tty->stamp(PrintGCTimeStamps);
1024 gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]"); 1024 gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]");
1025 } 1025 }
1026 } 1026 }
1027 } 1027 }
1028 1028
2462 // tables from the displayed time. 2462 // tables from the displayed time.
2463 { 2463 {
2464 if (G1Log::finer()) { 2464 if (G1Log::finer()) {
2465 gclog_or_tty->put(' '); 2465 gclog_or_tty->put(' ');
2466 } 2466 }
2467 GCTraceTime t("GC ref-proc", G1Log::finer(), false, g1h->gc_timer_cm()); 2467 GCTraceTime t("GC ref-proc", G1Log::finer(), false, g1h->gc_timer_cm(), concurrent_gc_id());
2468 2468
2469 ReferenceProcessor* rp = g1h->ref_processor_cm(); 2469 ReferenceProcessor* rp = g1h->ref_processor_cm();
2470 2470
2471 // See the comment in G1CollectedHeap::ref_processing_init() 2471 // See the comment in G1CollectedHeap::ref_processing_init()
2472 // about how reference processing currently works in G1. 2472 // about how reference processing currently works in G1.
2519 const ReferenceProcessorStats& stats = 2519 const ReferenceProcessorStats& stats =
2520 rp->process_discovered_references(&g1_is_alive, 2520 rp->process_discovered_references(&g1_is_alive,
2521 &g1_keep_alive, 2521 &g1_keep_alive,
2522 &g1_drain_mark_stack, 2522 &g1_drain_mark_stack,
2523 executor, 2523 executor,
2524 g1h->gc_timer_cm()); 2524 g1h->gc_timer_cm(),
2525 concurrent_gc_id());
2525 g1h->gc_tracer_cm()->report_gc_reference_stats(stats); 2526 g1h->gc_tracer_cm()->report_gc_reference_stats(stats);
2526 2527
2527 // The do_oop work routines of the keep_alive and drain_marking_stack 2528 // The do_oop work routines of the keep_alive and drain_marking_stack
2528 // oop closures will set the has_overflown flag if we overflow the 2529 // oop closures will set the has_overflown flag if we overflow the
2529 // global marking stack. 2530 // global marking stack.
3250 for (uint i = 0; i < _max_worker_id; ++i) { 3251 for (uint i = 0; i < _max_worker_id; ++i) {
3251 _tasks[i]->clear_region_fields(); 3252 _tasks[i]->clear_region_fields();
3252 } 3253 }
3253 _first_overflow_barrier_sync.abort(); 3254 _first_overflow_barrier_sync.abort();
3254 _second_overflow_barrier_sync.abort(); 3255 _second_overflow_barrier_sync.abort();
3256 const GCId& gc_id = _g1h->gc_tracer_cm()->gc_id();
3257 if (!gc_id.is_undefined()) {
3258 // We can do multiple full GCs before ConcurrentMarkThread::run() gets a chance
3259 // to detect that it was aborted. Only keep track of the first GC id that we aborted.
3260 _aborted_gc_id = gc_id;
3261 }
3255 _has_aborted = true; 3262 _has_aborted = true;
3256 3263
3257 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); 3264 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
3258 satb_mq_set.abandon_partial_marking(); 3265 satb_mq_set.abandon_partial_marking();
3259 // This can be called either during or outside marking, we'll read 3266 // This can be called either during or outside marking, we'll read
3262 false, /* new active value */ 3269 false, /* new active value */
3263 satb_mq_set.is_active() /* expected_active */); 3270 satb_mq_set.is_active() /* expected_active */);
3264 3271
3265 _g1h->trace_heap_after_concurrent_cycle(); 3272 _g1h->trace_heap_after_concurrent_cycle();
3266 _g1h->register_concurrent_cycle_end(); 3273 _g1h->register_concurrent_cycle_end();
3274 }
3275
3276 const GCId& ConcurrentMark::concurrent_gc_id() {
3277 if (has_aborted()) {
3278 return _aborted_gc_id;
3279 }
3280 return _g1h->gc_tracer_cm()->gc_id();
3267 } 3281 }
3268 3282
3269 static void print_ms_time_info(const char* prefix, const char* name, 3283 static void print_ms_time_info(const char* prefix, const char* name,
3270 NumberSeq& ns) { 3284 NumberSeq& ns) {
3271 gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).", 3285 gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).",