8057818: collect allocation context statistics at gc pauses
authorjcoomes
Wed, 10 Sep 2014 13:01:13 -0700
changeset 26841 d460d343d888
parent 26840 f3c7613a7bbb
child 26842 5081db39f634
8057818: collect allocation context statistics at gc pauses Reviewed-by: mikael, jmasa
hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Sep 09 04:48:41 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Sep 10 13:01:13 2014 -0700
@@ -3334,6 +3334,7 @@
   } else {
     g1_par_agg_task.work(0);
   }
+  _g1h->allocation_context_stats().update_at_remark();
 }
 
 // Clear the per-worker arrays used to store the per-region counting data
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp	Tue Sep 09 04:48:41 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp	Wed Sep 10 13:01:13 2014 -0700
@@ -41,4 +41,11 @@
   }
 };
 
+class AllocationContextStats: public StackObj {
+public:
+  inline void clear() { }
+  inline void update(bool full_gc) { }
+  inline void update_at_remark() { }
+};
+
 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATIONCONTEXT_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Sep 09 04:48:41 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Sep 10 13:01:13 2014 -0700
@@ -3596,7 +3596,7 @@
   }
 }
 
-void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) {
+void G1CollectedHeap::gc_epilogue(bool full) {
 
   if (G1SummarizeRSetStats &&
       (G1SummarizeRSetStatsPeriod > 0) &&
@@ -3613,6 +3613,7 @@
   // always_do_update_barrier = true;
 
   resize_all_tlabs();
+  allocation_context_stats().update(full);
 
   // We have just completed a GC. Update the soft reference
   // policy with the new heap occupancy
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Tue Sep 09 04:48:41 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Sep 10 13:01:13 2014 -0700
@@ -263,6 +263,9 @@
   // Class that handles the different kinds of allocations.
   G1Allocator* _allocator;
 
+  // Statistics for each allocation context
+  AllocationContextStats _allocation_context_stats;
+
   // PLAB sizing policy for survivors.
   PLABStats _survivor_plab_stats;
 
@@ -657,6 +660,8 @@
   // Determines PLAB size for a particular allocation purpose.
   size_t desired_plab_sz(GCAllocPurpose purpose);
 
+  inline AllocationContextStats& allocation_context_stats();
+
   // Do anything common to GC's.
   virtual void gc_prologue(bool full);
   virtual void gc_epilogue(bool full);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Tue Sep 09 04:48:41 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Wed Sep 10 13:01:13 2014 -0700
@@ -37,6 +37,10 @@
 
 // Inline functions for G1CollectedHeap
 
+inline AllocationContextStats& G1CollectedHeap::allocation_context_stats() {
+  return _allocation_context_stats;
+}
+
 // Return the region with the given index. It assumes the index is valid.
 inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm.at(index); }