changeset 4528:c49a43256225

8008918: Reference statistics events for the tracing framework Reviewed-by: jwilhelm, brutisso, tschatzl
author ehelin
date Mon, 18 Mar 2013 15:06:04 +0100
parents e99b6a69b81d
children 893fd4dc2d3b
files src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp src/share/vm/gc_implementation/g1/concurrentMark.cpp src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp src/share/vm/gc_implementation/g1/g1MarkSweep.cpp src/share/vm/gc_implementation/parNew/parNewGeneration.cpp src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp src/share/vm/memory/defNewGeneration.cpp src/share/vm/memory/genMarkSweep.cpp
diffstat 9 files changed, 54 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -5903,6 +5903,8 @@
                                 &cmsKeepAliveClosure, false /* !preclean */);
   {
     GCTraceTime t("weak refs processing", PrintGCDetails, false, _gc_timer_cm);
+
+    ReferenceProcessorStats stats;
     if (rp->processing_is_mt()) {
       // Set the degree of MT here.  If the discovery is done MT, there
       // may have been a different number of threads doing the discovery
@@ -5921,18 +5923,20 @@
       }
       rp->set_active_mt_degree(active_workers);
       CMSRefProcTaskExecutor task_executor(*this);
-      rp->process_discovered_references(&_is_alive_closure,
+      stats = rp->process_discovered_references(&_is_alive_closure,
                                         &cmsKeepAliveClosure,
                                         &cmsDrainMarkingStackClosure,
                                         &task_executor,
                                         _gc_timer_cm);
     } else {
-      rp->process_discovered_references(&_is_alive_closure,
+      stats = rp->process_discovered_references(&_is_alive_closure,
                                         &cmsKeepAliveClosure,
                                         &cmsDrainMarkingStackClosure,
                                         NULL,
                                         _gc_timer_cm);
     }
+    _gc_tracer_cm->report_gc_reference_stats(stats);
+
     verify_work_stacks_empty();
   }
 
--- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -37,6 +37,7 @@
 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
+#include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/gcTraceTime.hpp"
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/referencePolicy.hpp"
@@ -2325,6 +2326,7 @@
     G1CMRefProcTaskExecutor par_task_executor(g1h, this,
                                               g1h->workers(), active_workers);
 
+    ReferenceProcessorStats stats;
     if (rp->processing_is_mt()) {
       // Set the degree of MT here.  If the discovery is done MT, there
       // may have been a different number of threads doing the discovery
@@ -2333,7 +2335,7 @@
       // balance_all_queues() and balance_queues()).
       rp->set_active_mt_degree(active_workers);
 
-      rp->process_discovered_references(&g1_is_alive,
+      stats = rp->process_discovered_references(&g1_is_alive,
                                       &g1_keep_alive,
                                       &g1_drain_mark_stack,
                                       &par_task_executor,
@@ -2343,13 +2345,15 @@
       // will set the has_overflown flag if we overflow the global marking
       // stack.
     } else {
-      rp->process_discovered_references(&g1_is_alive,
+      stats = rp->process_discovered_references(&g1_is_alive,
                                         &g1_keep_alive,
                                         &g1_drain_mark_stack,
                                         NULL,
                                         g1h->gc_timer_cm());
     }
 
+    g1h->gc_tracer_cm()->report_gc_reference_stats(stats);
+
     assert(_markStack.overflow() || _markStack.isEmpty(),
             "mark stack should be empty (unless it overflowed)");
     if (_markStack.overflow()) {
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -5584,22 +5584,28 @@
   // Setup the soft refs policy...
   rp->setup_policy(false);
 
+  ReferenceProcessorStats stats;
   if (!rp->processing_is_mt()) {
     // Serial reference processing...
-    rp->process_discovered_references(&is_alive,
-                                      &keep_alive,
-                                      &drain_queue,
-                                      NULL,
-                                      _gc_timer_stw);
+    stats = rp->process_discovered_references(&is_alive,
+                                              &keep_alive,
+                                              &drain_queue,
+                                              NULL,
+                                              _gc_timer_stw);
   } else {
     // Parallel reference processing
     assert(rp->num_q() == no_of_gc_workers, "sanity");
     assert(no_of_gc_workers <= rp->max_num_q(), "sanity");
 
     G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, no_of_gc_workers);
-    rp->process_discovered_references(&is_alive, &keep_alive, &drain_queue, &par_task_executor, _gc_timer_stw);
-  }
-
+    stats = rp->process_discovered_references(&is_alive,
+                                              &keep_alive,
+                                              &drain_queue,
+                                              &par_task_executor,
+                                              _gc_timer_stw);
+  }
+
+  _gc_tracer_stw->report_gc_reference_stats(stats);
   // We have completed copying any necessary live referent objects
   // (that were not copied during the actual pause) so we can
   // retire any active alloc buffers
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon Mar 18 15:06:04 2013 +0100
@@ -1178,6 +1178,7 @@
   ReferenceProcessor* ref_processor_cm() const { return _ref_processor_cm; }
 
   ConcurrentGCTimer* gc_timer_cm() const { return _gc_timer_cm; }
+  G1OldTracer* gc_tracer_cm() const { return _gc_tracer_cm; }
 
   virtual size_t capacity() const;
   virtual size_t used() const;
--- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -148,11 +148,13 @@
   assert(rp == G1CollectedHeap::heap()->ref_processor_stw(), "Sanity");
 
   rp->setup_policy(clear_all_softrefs);
-  rp->process_discovered_references(&GenMarkSweep::is_alive,
-                                    &GenMarkSweep::keep_alive,
-                                    &GenMarkSweep::follow_stack_closure,
-                                    NULL,
-                                    gc_timer());
+  const ReferenceProcessorStats& stats =
+    rp->process_discovered_references(&GenMarkSweep::is_alive,
+                                      &GenMarkSweep::keep_alive,
+                                      &GenMarkSweep::follow_stack_closure,
+                                      NULL,
+                                      gc_timer());
+  gc_tracer()->report_gc_reference_stats(stats);
 
   // Follow system dictionary roots and unload classes
   bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -987,19 +987,21 @@
   rp->setup_policy(clear_all_soft_refs);
   // Can  the mt_degree be set later (at run_task() time would be best)?
   rp->set_active_mt_degree(active_workers);
+  ReferenceProcessorStats stats;
   if (rp->processing_is_mt()) {
     ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
-    rp->process_discovered_references(&is_alive, &keep_alive,
-                                      &evacuate_followers, &task_executor,
-                                      _gc_timer);
+    stats = rp->process_discovered_references(&is_alive, &keep_alive,
+                                              &evacuate_followers, &task_executor,
+                                              _gc_timer);
   } else {
     thread_state_set.flush();
     gch->set_par_threads(0);  // 0 ==> non-parallel.
     gch->save_marks();
-    rp->process_discovered_references(&is_alive, &keep_alive,
-                                      &evacuate_followers, NULL,
-                                      _gc_timer);
+    stats = rp->process_discovered_references(&is_alive, &keep_alive,
+                                              &evacuate_followers, NULL,
+                                              _gc_timer);
   }
+  gc_tracer.report_gc_reference_stats(stats);
   if (!promotion_failed()) {
     // Swap the survivor spaces.
     eden()->clear(SpaceDecorator::Mangle);
--- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -538,8 +538,10 @@
   // Process reference objects found during marking
   {
     ref_processor()->setup_policy(clear_all_softrefs);
-    ref_processor()->process_discovered_references(
-      is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer);
+    const ReferenceProcessorStats& stats =
+      ref_processor()->process_discovered_references(
+        is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer);
+    gc_tracer()->report_gc_reference_stats(stats);
   }
 
   // Follow system dictionary roots and unload classes
--- a/src/share/vm/memory/defNewGeneration.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/memory/defNewGeneration.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -610,8 +610,10 @@
   FastKeepAliveClosure keep_alive(this, &scan_weak_ref);
   ReferenceProcessor* rp = ref_processor();
   rp->setup_policy(clear_all_soft_refs);
-  rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers,
-                                    NULL, _gc_timer);
+  const ReferenceProcessorStats& stats =
+    rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers,
+                                      NULL, _gc_timer);
+  gc_tracer.report_gc_reference_stats(stats);
   if (!promotion_failed()) {
     // Swap the survivor spaces.
     eden()->clear(SpaceDecorator::Mangle);
--- a/src/share/vm/memory/genMarkSweep.cpp	Mon Mar 18 12:29:19 2013 +0100
+++ b/src/share/vm/memory/genMarkSweep.cpp	Mon Mar 18 15:06:04 2013 +0100
@@ -291,8 +291,10 @@
   // Process reference objects found during marking
   {
     ref_processor()->setup_policy(clear_all_softrefs);
-    ref_processor()->process_discovered_references(
-      &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer);
+    const ReferenceProcessorStats& stats =
+      ref_processor()->process_discovered_references(
+        &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer);
+    gc_tracer()->report_gc_reference_stats(stats);
   }
 
   // Follow system dictionary roots and unload classes