changeset 4355:97f2e3ceb67c

8010916: Add tenuring threshold to young garbage collection events Reviewed-by: jwilhelm, brutisso
author ehelin
date Wed, 10 Apr 2013 09:43:53 +0200
parents c7b481c7e5d9
children 6f73a3a47ba4 d67b08a0b6c0
files src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp src/share/vm/gc_implementation/parNew/parNewGeneration.cpp src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 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/memory/defNewGeneration.cpp src/share/vm/trace/trace.xml
diffstat 9 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Apr 10 09:43:53 2013 +0200
@@ -4170,6 +4170,8 @@
     // before any GC notifications are raised.
     g1mm()->update_sizes();
 
+    _gc_tracer_stw->report_tenuring_threshold(_g1_policy->tenuring_threshold());
+
     _gc_timer_stw->register_gc_end(os::elapsed_counter());
 
     _gc_tracer_stw->report_gc_end(_gc_timer_stw->gc_end(), _gc_timer_stw->time_partitions());
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Wed Apr 10 09:43:53 2013 +0200
@@ -861,6 +861,7 @@
   ageTable _survivors_age_table;
 
 public:
+  uint tenuring_threshold() const { return _tenuring_threshold; }
 
   inline GCAllocPurpose
     evacuation_destination(HeapRegion* src_region, int age, size_t word_sz) {
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Apr 10 09:43:53 2013 +0200
@@ -1098,6 +1098,7 @@
   rp->verify_no_references_recorded();
 
   gch->trace_heap_after_gc(&gc_tracer);
+  gc_tracer.report_tenuring_threshold(tenuring_threshold());
 
   _gc_timer->register_gc_end(os::elapsed_counter());
 
--- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Apr 10 09:43:53 2013 +0200
@@ -668,6 +668,7 @@
 
   heap->print_heap_after_gc();
   heap->trace_heap_after_gc(&_gc_tracer);
+  _gc_tracer.report_tenuring_threshold(tenuring_threshold());
 
   if (ZapUnusedHeapArea) {
     young_gen->eden_space()->check_mangled_unused_area_complete();
--- a/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Apr 10 09:43:53 2013 +0200
@@ -94,9 +94,12 @@
 
 void YoungGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
+  assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported");
 
   GCTracer::report_gc_end_impl(timestamp, time_partitions);
   send_young_gc_event();
+
+  _tenuring_threshold = UNSET_TENURING_THRESHOLD;
 }
 
 void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) {
@@ -105,6 +108,9 @@
   send_promotion_failed_event(pf_info);
 }
 
+void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) {
+  _tenuring_threshold = tenuring_threshold;
+}
 
 void OldGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
--- a/src/share/vm/gc_implementation/shared/gcTrace.hpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp	Wed Apr 10 09:43:53 2013 +0200
@@ -134,14 +134,17 @@
 };
 
 class YoungGCTracer : public GCTracer {
+  static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
+
+  uint _tenuring_threshold;
+
  protected:
-  YoungGCTracer(GCName name) : GCTracer(name) {}
+  YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
+  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
 
  public:
   void report_promotion_failed(const PromotionFailedInfo& pf_info);
-
- protected:
-  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
+  void report_tenuring_threshold(const uint tenuring_threshold);
 
  private:
   void send_young_gc_event() const;
@@ -151,8 +154,6 @@
 class OldGCTracer : public GCTracer {
  protected:
   OldGCTracer(GCName name) : GCTracer(name) {}
-
- protected:
   virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
 
  private:
--- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Wed Apr 10 09:43:53 2013 +0200
@@ -76,6 +76,7 @@
   EventGCYoungGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(_shared_gc_info.id());
+    e.set_tenuringThreshold(_tenuring_threshold);
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
     e.commit();
--- a/src/share/vm/memory/defNewGeneration.cpp	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/memory/defNewGeneration.cpp	Wed Apr 10 09:43:53 2013 +0200
@@ -680,6 +680,7 @@
   update_time_of_last_gc(now);
 
   gch->trace_heap_after_gc(&gc_tracer);
+  gc_tracer.report_tenuring_threshold(tenuring_threshold());
 
   _gc_timer->register_gc_end(os::elapsed_counter());
 
--- a/src/share/vm/trace/trace.xml	Wed Feb 27 22:40:14 2013 +0000
+++ b/src/share/vm/trace/trace.xml	Wed Apr 10 09:43:53 2013 +0200
@@ -168,6 +168,7 @@
     <event id="GCYoungGarbageCollection" path="vm/gc/collector/young_garbage_collection" label="Young Garbage Collection"
            description="Extra information specific to Young Garbage Collections">
       <value type="ULONG" field="gcId"  label="GC ID" relation="GC_ID" />
+      <value type="UINT" field="tenuringThreshold" label="Tenuring Threshold" />
     </event>
 
     <event id="GCOldGarbageCollection" path="vm/gc/collector/old_garbage_collection" label="Old Garbage Collection"