From b9f7caed775e86e71f7d37789cb196fb1444ef12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20Sikstr=C3=B6m?= Date: Thu, 31 Jul 2025 07:40:22 +0000 Subject: [PATCH] 8364282: ZGC: Improve ZPageAllocation JFR event sending Reviewed-by: stefank, aboldtch --- src/hotspot/share/gc/z/zPageAllocator.cpp | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/gc/z/zPageAllocator.cpp b/src/hotspot/share/gc/z/zPageAllocator.cpp index 80a53feed71..52d5d775757 100644 --- a/src/hotspot/share/gc/z/zPageAllocator.cpp +++ b/src/hotspot/share/gc/z/zPageAllocator.cpp @@ -547,21 +547,24 @@ public: } void send_event(bool successful) { - EventZPageAllocation event; + if (!EventZPageAllocation::is_enabled()) { + // Event not enabled, exit early + return; + } Ticks end_timestamp = Ticks::now(); const ZPageAllocationStats st = stats(); - event.commit(_start_timestamp, - end_timestamp, - (u8)_type, - size(), - st._total_harvested, - st._total_committed_capacity, - (unsigned)st._num_harvested_vmems, - _is_multi_partition, - successful, - _flags.non_blocking()); + EventZPageAllocation::commit(_start_timestamp, + end_timestamp, + (u8)_type, + size(), + st._total_harvested, + st._total_committed_capacity, + (unsigned)st._num_harvested_vmems, + _is_multi_partition, + successful, + _flags.non_blocking()); } };