While working on JDK-8185525 and JDK-8211331 a question raised about the mechanism one can use to figure out whether we need to keep collecting relevant statistics for JFR events.
Currently we have:
- JFR_ONLY() macro
- Jfr::is_recording()
- Jfr::is_enabled()
but I don't think that these give us the required granularity.
Imagine a computation needed by EventA. With JFR compiled in, and the recording ON and enabled, we still can not be 100% sure whether the EventA itself is being recorded or not, so we have currently no choice, but to collect the data for EventA, even when that particular event is not actually being recorded.
We need something like Jfr::is_on(EventA)
With JFR asking for more and more events, without such granularity we will be waisting resources and impacting the entire JFR framework by ever so slightly slowing it down as we continue to add new events.