--- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2014-10-03 14:44:50.883684266 -0700 +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2014-10-03 14:44:50.799684267 -0700 @@ -4214,7 +4214,7 @@ _hrm.verify_optional(); verify_region_sets_optional(); - TASKQUEUE_STATS_ONLY(if (ParallelGCVerbose) print_taskqueue_stats()); + TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) print_taskqueue_stats()); TASKQUEUE_STATS_ONLY(reset_taskqueue_stats()); print_heap_after_gc(); @@ -4798,7 +4798,7 @@ _g1h->g1_policy()->record_thread_age_table(pss.age_table()); _g1h->update_surviving_young_words(pss.surviving_young_words()+1); - if (ParallelGCVerbose) { + if (PrintTerminationStats) { MutexLocker x(stats_lock()); pss.print_termination_stats(worker_id); } @@ -5889,7 +5889,7 @@ if (G1CollectedHeap::use_parallel_gc_threads()) { // The individual threads will set their evac-failure closures. - if (ParallelGCVerbose) G1ParScanThreadState::print_termination_stats_hdr(); + if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr(); // These tasks use ShareHeap::_process_strong_tasks assert(UseDynamicNumberOfGCThreads || workers()->active_workers() == workers()->total_workers(), --- old/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2014-10-03 14:44:51.279684258 -0700 +++ new/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2014-10-03 14:44:51.199684260 -0700 @@ -1065,10 +1065,8 @@ gch->print_heap_change(gch_prev_used); } - if (PrintGCDetails && ParallelGCVerbose) { - TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats()); - TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats()); - } + TASKQUEUE_STATS_ONLY(if (PrintTerminationStats) thread_state_set.print_termination_stats()); + TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) thread_state_set.print_taskqueue_stats()); if (UseAdaptiveSizePolicy) { size_policy->minor_collection_end(gch->gc_cause()); --- old/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp 2014-10-03 14:44:51.623684252 -0700 +++ new/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp 2014-10-03 14:44:51.547684253 -0700 @@ -91,7 +91,7 @@ bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { bool promotion_failure_occurred = false; - TASKQUEUE_STATS_ONLY(if (PrintGCDetails && ParallelGCVerbose) print_stats()); + TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) print_taskqueue_stats()); for (uint i = 0; i < ParallelGCThreads + 1; i++) { PSPromotionManager* manager = manager_array(i); assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); @@ -106,16 +106,9 @@ #if TASKQUEUE_STATS void -PSPromotionManager::print_taskqueue_stats(uint i) const { - tty->print("%3u ", i); - _claimed_stack_depth.stats.print(); - tty->cr(); -} - -void -PSPromotionManager::print_local_stats(uint i) const { +PSPromotionManager::print_local_stats(outputStream* const out, uint i) const { #define FMT " " SIZE_FORMAT_W(10) - tty->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, + out->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, _arrays_chunked, _array_chunks_processed); #undef FMT } @@ -127,20 +120,24 @@ }; void -PSPromotionManager::print_stats() { - tty->print_cr("== GC Tasks Stats, GC %3d", +PSPromotionManager::print_taskqueue_stats(outputStream* const out) { + out->print_cr("== GC Tasks Stats, GC %3d", Universe::heap()->total_collections()); - tty->print("thr "); TaskQueueStats::print_header(1); tty->cr(); - tty->print("--- "); TaskQueueStats::print_header(2); tty->cr(); + TaskQueueStats totals; + out->print("thr "); TaskQueueStats::print_header(1, out); out->cr(); + out->print("--- "); TaskQueueStats::print_header(2, out); out->cr(); for (uint i = 0; i < ParallelGCThreads + 1; ++i) { - manager_array(i)->print_taskqueue_stats(i); + TaskQueueStats& next = manager_array(i)->_claimed_stack_depth.stats; + out->print("%3d ", i); next.print(out); out->cr(); + totals += next; } + out->print("tot "); totals.print(out); out->cr(); const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); - for (uint i = 0; i < hlines; ++i) tty->print_cr("%s", pm_stats_hdr[i]); + for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]); for (uint i = 0; i < ParallelGCThreads + 1; ++i) { - manager_array(i)->print_local_stats(i); + manager_array(i)->print_local_stats(out, i); } } --- old/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp 2014-10-03 14:44:51.931684246 -0700 +++ new/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp 2014-10-03 14:44:51.851684248 -0700 @@ -68,9 +68,8 @@ size_t _arrays_chunked; size_t _array_chunks_processed; - void print_taskqueue_stats(uint i) const; - void print_local_stats(uint i) const; - static void print_stats(); + void print_local_stats(outputStream* const out, uint i) const; + static void print_taskqueue_stats(outputStream* const out = gclog_or_tty); void reset_stats(); #endif // TASKQUEUE_STATS --- old/src/share/vm/runtime/globals.hpp 2014-10-03 14:44:52.255684240 -0700 +++ new/src/share/vm/runtime/globals.hpp 2014-10-03 14:44:52.167684242 -0700 @@ -1529,8 +1529,11 @@ product(bool, UseParNewGC, false, \ "Use parallel threads in the new generation") \ \ - product(bool, ParallelGCVerbose, false, \ - "Verbose output for parallel gc") \ + product(bool, PrintTaskqueue, false, \ + "Print taskqueue statistics for parallel collectors") \ + \ + product(bool, PrintTerminationStats, false, \ + "Print termination statistics for parallel collectors") \ \ product(uintx, ParallelGCBufferWastePct, 10, \ "Wasted fraction of parallel allocation buffer") \