8151674: STW phases at Concurrent GC should count in PerfCounter
authorysuenaga
Wed, 30 Mar 2016 21:05:13 +0900
changeset 37218 c7241bc368bf
parent 37213 44ada89d5ba3
child 37219 f10efd38ccd3
8151674: STW phases at Concurrent GC should count in PerfCounter Reviewed-by: jmasa, sla, tschatzl
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp
hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp
hotspot/src/share/vm/gc/g1/g1MonitoringSupport.hpp
hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp
hotspot/src/share/vm/gc/shared/vmGCOperations.hpp
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Mar 30 21:05:13 2016 +0900
@@ -626,6 +626,7 @@
 
   NOT_PRODUCT(_overflow_counter = CMSMarkStackOverflowInterval;)
   _gc_counters = new CollectorCounters("CMS", 1);
+  _cgc_counters = new CollectorCounters("CMS stop-the-world phases", 2);
   _completed_initialization = true;
   _inter_sweep_timer.start();  // start of time
 }
@@ -5546,18 +5547,18 @@
 
 void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
   GCTraceCPUTime tcpu;
-  TraceCollectorStats tcs(counters());
+  TraceCollectorStats tcs(cgc_counters());
 
   switch (op) {
     case CMS_op_checkpointRootsInitial: {
       GCTraceTime(Info, gc) t("Pause Initial Mark", NULL, GCCause::_no_gc, true);
-      SvcGCMarker sgcm(SvcGCMarker::OTHER);
+      SvcGCMarker sgcm(SvcGCMarker::CONCURRENT);
       checkpointRootsInitial();
       break;
     }
     case CMS_op_checkpointRootsFinal: {
       GCTraceTime(Info, gc) t("Pause Remark", NULL, GCCause::_no_gc, true);
-      SvcGCMarker sgcm(SvcGCMarker::OTHER);
+      SvcGCMarker sgcm(SvcGCMarker::CONCURRENT);
       checkpointRootsFinal();
       break;
     }
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Wed Mar 30 21:05:13 2016 +0900
@@ -555,6 +555,7 @@
 
   // Performance Counters
   CollectorCounters* _gc_counters;
+  CollectorCounters* _cgc_counters;
 
   // Initialization Errors
   bool _completed_initialization;
@@ -929,7 +930,8 @@
   NOT_PRODUCT(bool is_cms_reachable(HeapWord* addr);)
 
   // Performance Counter Support
-  CollectorCounters* counters()    { return _gc_counters; }
+  CollectorCounters* counters()     { return _gc_counters; }
+  CollectorCounters* cgc_counters() { return _cgc_counters; }
 
   // Timer stuff
   void    startTimer() { assert(!_timer.is_active(), "Error"); _timer.start();   }
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Wed Mar 30 21:05:13 2016 +0900
@@ -1072,8 +1072,6 @@
     return;
   }
 
-  SvcGCMarker sgcm(SvcGCMarker::OTHER);
-
   if (VerifyDuringGC) {
     HandleMark hm;  // handle scope
     g1h->prepare_for_verify();
--- a/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp	Wed Mar 30 21:05:13 2016 +0900
@@ -76,6 +76,7 @@
   _g1h(g1h),
   _incremental_collection_counters(NULL),
   _full_collection_counters(NULL),
+  _conc_collection_counters(NULL),
   _old_collection_counters(NULL),
   _old_space_counters(NULL),
   _young_collection_counters(NULL),
@@ -104,6 +105,9 @@
   // old generation collection.
   _full_collection_counters =
     new CollectorCounters("G1 stop-the-world full collections", 1);
+  // name "collector.2". STW phases as part of a concurrent collection.
+  _conc_collection_counters =
+    new CollectorCounters("G1 stop-the-world phases", 2);
 
   // timer sampling for all counters supporting sampling only update the
   // used value.  See the take_sample() method.  G1 requires both used and
--- a/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.hpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.hpp	Wed Mar 30 21:05:13 2016 +0900
@@ -122,6 +122,8 @@
   CollectorCounters*   _incremental_collection_counters;
   //  full stop-the-world collections
   CollectorCounters*   _full_collection_counters;
+  //  stop-the-world phases in G1
+  CollectorCounters*   _conc_collection_counters;
   //  young collection set counters.  The _eden_counters,
   // _from_counters, and _to_counters are associated with
   // this "generational" counter.
@@ -210,6 +212,9 @@
   CollectorCounters* full_collection_counters() {
     return _full_collection_counters;
   }
+  CollectorCounters* conc_collection_counters() {
+    return _conc_collection_counters;
+  }
   GenerationCounters* young_collection_counters() {
     return _young_collection_counters;
   }
--- a/hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp	Wed Mar 30 21:05:13 2016 +0900
@@ -217,6 +217,8 @@
   GCTraceCPUTime tcpu;
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   GCTraceTime(Info, gc) t(_printGCMessage, g1h->concurrent_mark()->gc_timer_cm(), GCCause::_no_gc, true);
+  TraceCollectorStats tcs(g1h->g1mm()->conc_collection_counters());
+  SvcGCMarker sgcm(SvcGCMarker::CONCURRENT);
   IsGCActiveMark x;
   _cl->do_void();
 }
--- a/hotspot/src/share/vm/gc/shared/vmGCOperations.hpp	Thu Mar 31 14:18:25 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/vmGCOperations.hpp	Wed Mar 30 21:05:13 2016 +0900
@@ -235,7 +235,7 @@
  private:
   JvmtiGCMarker _jgcm;
  public:
-  typedef enum { MINOR, FULL, OTHER } reason_type;
+  typedef enum { MINOR, FULL, CONCURRENT, OTHER } reason_type;
 
   SvcGCMarker(reason_type reason ) {
     VM_GC_Operation::notify_gc_begin(reason == FULL);