src/share/vm/gc_implementation/shared/gcTrace.cpp

Print this page

        

@@ -29,13 +29,15 @@
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/objectCountEventSender.hpp"
 #include "memory/heapInspection.hpp"
 #include "memory/referenceProcessorStats.hpp"
+#include "runtime/handles.hpp"
 #include "runtime/os.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/ticks.inline.hpp"
+#include "trace/tracing.hpp"
 
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/evacuationInfo.hpp"
 #endif
 

@@ -170,10 +172,36 @@
 
 void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) {
   _tenuring_threshold = tenuring_threshold;
 }
 
+void YoungGCTracer::report_promotion_to_new_plab(oop const old, uint age, bool tenured, size_t plab_size) {
+
+  EventPromotionSample event;
+  
+  if (event.should_commit()) {
+    event.set_gcId(_shared_gc_info.gc_id().id());
+    event.set_class(KlassHandle(old->klass())());
+    event.set_objectSize((size_t)old->size());
+    event.set_tenured(tenured);
+    event.set_age(age);
+
+    // If the PLAB size is the same as the object size the copy was done directly 
+    // to the heap instead of allocating a new PLAB to copy the object to
+    if ((size_t)old->size() == plab_size) {
+      event.set_directAllocation(true);
+      // Set plabSize to 0 as it otherwise will be a random value
+      event.set_plabSize(0);
+    } else {
+      event.set_directAllocation(false);
+      event.set_plabSize(plab_size);
+    }
+
+    event.commit();
+  }
+}
+
 void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
 
   GCTracer::report_gc_end_impl(timestamp, time_partitions);
   send_old_gc_event();