changeset 27154:ccf8883e01be

8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1 Summary: Changed flag names for printing taskqueue and termination statistics for parallel gc, parNew and G1. Reviewed-by: jwilhelm, brutisso, tschatzl Contributed-by: sangheon.kim@oracle.com
author jwilhelm
date Tue, 14 Oct 2014 20:58:43 +0200
parents 0b4c3ec93238
children 9059987242ca
files hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp hotspot/src/share/vm/runtime/globals.hpp
diffstat 5 files changed, 26 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Oct 13 16:05:46 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Oct 14 20:58:43 2014 +0200
@@ -4098,7 +4098,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();
@@ -4668,7 +4668,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);
       }
@@ -5762,7 +5762,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(),
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Mon Oct 13 16:05:46 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Tue Oct 14 20:58:43 2014 +0200
@@ -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());
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Mon Oct 13 16:05:46 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Tue Oct 14 20:58:43 2014 +0200
@@ -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);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Mon Oct 13 16:05:46 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Tue Oct 14 20:58:43 2014 +0200
@@ -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
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon Oct 13 16:05:46 2014 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Tue Oct 14 20:58:43 2014 +0200
@@ -1533,8 +1533,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")                  \