RFR: 8365611: Throttle any JFR event

Markus Grönlund mgronlun at openjdk.org
Mon Aug 18 10:41:11 UTC 2025


On Fri, 15 Aug 2025 14:58:12 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> This patch prepares the way to throttle any JFR event, not only the three events for which we hard-code throttlers. It also cleans up the throttler code and replaces the switch construct with a lookup table.
> 
> The patch does not yet enable throttling for any other event, since that may be a contentious move, and I would like for this patch to go in without too much fuss. So I did not make any new events "throttleble".
> 
> If it turns out to be non-contentious, I am fine with just enabling throttling capability for all events.

Changes requested by mgronlun (Reviewer).

src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp line 101:

> 99: }
> 100: 
> 101: // There is currently only two throttler instances, one for the jdk.ObjectAllocationSample event

Now we can remove this comment.

src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp line 117:

> 115: 
> 116: JfrEventThrottler* JfrEventThrottler::create_throttler(JfrEventId id) {
> 117:   JfrEventThrottler* p = new JfrEventThrottler(id);

JfrEventThrottler is a JfrAdaptiveSampler that utilizes the JfrCHeapObj allocator, which can return nullptr during JFR initialization.

src/hotspot/share/jfr/recorder/service/jfrEventThrottler.hpp line 53:

> 51: 
> 52:  public:
> 53:   static JfrEventThrottler* create_throttler(JfrEventId event_id);

Please make this private and add ThrottlerLookupTable as a friend.

-------------

PR Review: https://git.openjdk.org/jdk/pull/26801#pullrequestreview-3127803372
PR Review Comment: https://git.openjdk.org/jdk/pull/26801#discussion_r2282002313
PR Review Comment: https://git.openjdk.org/jdk/pull/26801#discussion_r2282014257
PR Review Comment: https://git.openjdk.org/jdk/pull/26801#discussion_r2281999373


More information about the hotspot-jfr-dev mailing list