RFR: 8310994: Add JFR event for selection operations

Alan Bateman alanb at openjdk.org
Tue Nov 21 20:25:16 UTC 2023


On Fri, 17 Nov 2023 16:22:55 GMT, Tim Prinzing <tprinzing at openjdk.org> wrote:

> Added mirror event with static methods: jdk.internal.event.SelectionEvent that provides the duration of select calls and the count of how many keys are available.
> 
> Emit the event from SelectorImpl::lockAndDoSelect
> 
> Test at jdk.jfr.event.io.TestSelectionEvents

src/java.base/share/classes/sun/nio/ch/SelectorImpl.java line 141:

> 139:                         SelectionEvent.commit(start, duration, n);
> 140:                     }
> 141:                     return n;

I'd prefer if the existing code moved to implLockAndDoSelect so that lockAndDoSelect commits the event outside of the locked region.

test/jdk/jdk/jfr/event/io/TestSelectionEvents.java line 70:

> 68:                     SocketChannel sc2 = ssc.accept()) {
> 69: 
> 70:                     Selector sel = Selector.open();

You can add this to the try block so that the selector is closed too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16710#discussion_r1397596209
PR Review Comment: https://git.openjdk.org/jdk/pull/16710#discussion_r1397593894


More information about the hotspot-jfr-dev mailing list