diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
index dba0c5f709b..79af8d24eb4 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
@@ -172,6 +172,27 @@ void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) {
_tenuring_threshold = tenuring_threshold;
}
+bool YoungGCTracer::should_report_promotion_in_new_plab_event() const {
+ return should_send_promotion_in_new_plab_event();
+}
+
+bool YoungGCTracer::should_report_promotion_outside_plab_event() const {
+ return should_send_promotion_outside_plab_event();
+}
+
+void YoungGCTracer::report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured,
+ size_t plab_size) const {
+ assert_set_gc_id();
+ send_promotion_in_new_plab_event(klass, obj_size, age, tenured, plab_size);
+}
+
+void YoungGCTracer::report_promotion_outside_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured) const {
+ assert_set_gc_id();
+ send_promotion_outside_plab_event(klass, obj_size, age, tenured);
+}
+
void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
index 20342ebc244..9774dcb9537 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
@@ -156,9 +156,38 @@ class YoungGCTracer : public GCTracer {
void report_promotion_failed(const PromotionFailedInfo& pf_info);
void report_tenuring_threshold(const uint tenuring_threshold);
+ /*
+ * Methods for reporting Promotion in new or outside PLAB Events.
+ *
+ * The object age is always required as it is not certain that the mark word
+ * of the oop can be trusted at this stage.
+ *
+ * obj_size is the size of the promoted object in bytes.
+ *
+ * tenured should be true if the object has been promoted to the old
+ * space during this GC, if the object is copied to survivor space
+ * from young space or survivor space (aging) tenured should be false.
+ *
+ * plab_size is the size of the newly allocated PLAB in bytes.
+ */
+ bool should_report_promotion_in_new_plab_event() const;
+ bool should_report_promotion_outside_plab_event() const;
+ void report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured,
+ size_t plab_size) const;
+ void report_promotion_outside_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured) const;
+
private:
void send_young_gc_event() const;
void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
+ bool should_send_promotion_in_new_plab_event() const;
+ bool should_send_promotion_outside_plab_event() const;
+ void send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured,
+ size_t plab_size) const;
+ void send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured) const;
};
class OldGCTracer : public GCTracer {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
index 97055694fae..326625bf1a8 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
@@ -111,6 +111,44 @@ void YoungGCTracer::send_young_gc_event() const {
}
}
+bool YoungGCTracer::should_send_promotion_in_new_plab_event() const {
+ return EventPromoteObjectInNewPLAB::is_enabled();
+}
+
+bool YoungGCTracer::should_send_promotion_outside_plab_event() const {
+ return EventPromoteObjectOutsidePLAB::is_enabled();
+}
+
+void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured,
+ size_t plab_size) const {
+
+ EventPromoteObjectInNewPLAB event;
+ if (event.should_commit()) {
+ event.set_gcId(_shared_gc_info.gc_id().id());
+ event.set_class(klass);
+ event.set_objectSize(obj_size);
+ event.set_tenured(tenured);
+ event.set_tenuringAge(age);
+ event.set_plabSize(plab_size);
+ event.commit();
+ }
+}
+
+void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
+ uint age, bool tenured) const {
+
+ EventPromoteObjectOutsidePLAB event;
+ if (event.should_commit()) {
+ event.set_gcId(_shared_gc_info.gc_id().id());
+ event.set_class(klass);
+ event.set_objectSize(obj_size);
+ event.set_tenured(tenured);
+ event.set_tenuringAge(age);
+ event.commit();
+ }
+}
+
void OldGCTracer::send_old_gc_event() const {
EventGCOldGarbageCollection e(UNTIMED);
if (e.should_commit()) {
diff --git a/hotspot/src/share/vm/trace/trace.xml b/hotspot/src/share/vm/trace/trace.xml
index 120d27f4d4d..fc7acd38e95 100644
--- a/hotspot/src/share/vm/trace/trace.xml
+++ b/hotspot/src/share/vm/trace/trace.xml
@@ -314,6 +314,28 @@ Declares a structure type that can be used in other events.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+