changeset 4350:5c44c9466675

8008917: CMS: Concurrent mode failure tracing event Reviewed-by: jwilhelm, ehelin, brutisso
author kevinw
date Fri, 05 Apr 2013 11:06:55 +0100
parents 03ba6eb06186
children d6cf0e0eee29
files src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp src/share/vm/gc_implementation/shared/gcTrace.cpp src/share/vm/gc_implementation/shared/gcTrace.hpp src/share/vm/gc_implementation/shared/gcTraceSend.cpp src/share/vm/trace/trace.xml
diffstat 6 files changed, 48 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Apr 05 08:53:29 2013 +0200
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Apr 05 11:06:55 2013 +0100
@@ -1695,6 +1695,24 @@
   }
 }
 
+bool CMSCollector::is_external_interruption() {
+  GCCause::Cause cause = GenCollectedHeap::heap()->gc_cause();
+  return GCCause::is_user_requested_gc(cause) ||
+         GCCause::is_serviceability_requested_gc(cause);
+}
+
+void CMSCollector::report_concurrent_mode_interruption() {
+  if (is_external_interruption()) {
+    if (PrintGCDetails) {
+      gclog_or_tty->print(" (concurrent mode interrupted)");
+    }
+  } else {
+    if (PrintGCDetails) {
+      gclog_or_tty->print(" (concurrent mode failure)");
+    }
+    _gc_tracer_cm->report_concurrent_mode_failure();
+  }
+}
 
 // The foreground and background collectors need to coordinate in order
 // to make sure that they do not mutually interfere with CMS collections.
@@ -1852,14 +1870,8 @@
   }
 )
 
-  if (PrintGCDetails && first_state > Idling) {
-    GCCause::Cause cause = GenCollectedHeap::heap()->gc_cause();
-    if (GCCause::is_user_requested_gc(cause) ||
-        GCCause::is_serviceability_requested_gc(cause)) {
-      gclog_or_tty->print(" (concurrent mode interrupted)");
-    } else {
-      gclog_or_tty->print(" (concurrent mode failure)");
-    }
+  if (first_state > Idling) {
+    report_concurrent_mode_interruption();
   }
 
   if (should_compact) {
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Fri Apr 05 08:53:29 2013 +0200
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Fri Apr 05 11:06:55 2013 +0100
@@ -850,6 +850,10 @@
   void do_mark_sweep_work(bool clear_all_soft_refs,
     CollectorState first_state, bool should_start_over);
 
+  // Work methods for reporting concurrent mode interruption or failure
+  bool is_external_interruption();
+  void report_concurrent_mode_interruption();
+
   // If the backgrould GC is active, acquire control from the background
   // GC and do the collection.
   void acquire_control_and_collect(bool   full, bool clear_all_soft_refs);
--- a/src/share/vm/gc_implementation/shared/gcTrace.cpp	Fri Apr 05 08:53:29 2013 +0200
+++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp	Fri Apr 05 11:06:55 2013 +0100
@@ -126,6 +126,12 @@
   _parallel_old_gc_info.report_dense_prefix(dense_prefix);
 }
 
+void CMSTracer::report_concurrent_mode_failure() {
+  assert_set_gc_id();
+
+  send_concurrent_mode_failure_event();
+}
+
 #ifndef SERIALGC
 void G1NewTracer::report_yc_type(G1YCType type) {
   assert_set_gc_id();
--- a/src/share/vm/gc_implementation/shared/gcTrace.hpp	Fri Apr 05 08:53:29 2013 +0200
+++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp	Fri Apr 05 11:06:55 2013 +0100
@@ -211,6 +211,11 @@
 class CMSTracer : public OldGCTracer {
  public:
   CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
+
+  void report_concurrent_mode_failure();
+
+ private:
+  void send_concurrent_mode_failure_event();
 };
 
 class G1OldTracer : public OldGCTracer {
--- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Fri Apr 05 08:53:29 2013 +0200
+++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Fri Apr 05 11:06:55 2013 +0100
@@ -111,6 +111,14 @@
   }
 }
 
+void CMSTracer::send_concurrent_mode_failure_event() {
+  EventConcurrentModeFailure e;
+  if (e.should_commit()) {
+    e.set_gcId(_shared_gc_info.id());
+    e.commit();
+  }
+}
+
 #ifndef SERIALGC
 void G1NewTracer::send_g1_young_gc_event() {
   EventGCG1GarbageCollection e(UNTIMED);
--- a/src/share/vm/trace/trace.xml	Fri Apr 05 08:53:29 2013 +0200
+++ b/src/share/vm/trace/trace.xml	Fri Apr 05 11:06:55 2013 +0100
@@ -203,6 +203,11 @@
       <structvalue type="CopyFailed" field="data" label="data"/>
     </event>
 
+    <event id="ConcurrentModeFailure" path="vm/gc/detailed/concurrent_mode_failure" label="Concurrent Mode Failure"
+           is_instant="true" description="Concurrent Mode failed">
+      <value type="ULONG" field="gcId" label="GC ID" relation="GC_ID"/>
+    </event>
+
     <event id="GCPhasePause" path="vm/gc/phases/pause" label="GC Phase Pause">
       <value type="ULONG" field="gcId" label="GC ID" relation="GC_ID"/>
       <value type="UTF8" field="name" label="Name" />