RFR: 8310978: JFR events SocketReadEvent/SocketWriteEvent for Socket adaptor ops [v3]

Alan Bateman alanb at openjdk.org
Thu Oct 26 10:44:35 UTC 2023


On Wed, 25 Oct 2023 21:43:54 GMT, Tim Prinzing <tprinzing at openjdk.org> wrote:

>> Added jar event support to socket adapters.
>> 
>> Added the test jdk/jfr/event/io/TestSocketAdapterEvents.java
>
> Tim Prinzing has updated the pull request incrementally with one additional commit since the last revision:
> 
>   changes from review:
>   
>   - use loopback address
>   - fetch timeout once
>   - formatting improvements

src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 497:

> 495:         long start = SocketReadEvent.timestamp();
> 496:         int nbytes = implRead(buf);
> 497:         SocketReadEvent.offer(start, nbytes, remoteAddress(), 0);

I don't have a strong opinion on shouldCommit+emit vs. offer, both are readable at the use sites. If we go with what you have then we'll need to look into making remoteAddress a stable field.

src/java.base/share/classes/sun/nio/ch/SocketInputStream.java line 83:

> 81:         int n = implRead(b, off, len, timeout);
> 82:         SocketReadEvent.offer(start, n, sc.remoteAddress(), timeout);
> 83:         return n;

This is better, it means that the event is guaranteed to use the same timeout as the read operation.

test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java line 75:

> 73:                 recording.start();
> 74: 
> 75:                 ssc.socket().setReuseAddress(true);

No need for setReuseAddress here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16251#discussion_r1372953644
PR Review Comment: https://git.openjdk.org/jdk/pull/16251#discussion_r1372954447
PR Review Comment: https://git.openjdk.org/jdk/pull/16251#discussion_r1372956024


More information about the hotspot-jfr-dev mailing list