mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8316927: JFR: Move shouldCommit check earlier for socket events
Reviewed-by: alanb, dfuchs, mgronlun
This commit is contained in:
parent
5ca1beb30e
commit
6aa837eee6
5 changed files with 49 additions and 29 deletions
|
@ -1096,7 +1096,10 @@ public class Socket implements java.io.Closeable {
|
|||
}
|
||||
long start = SocketReadEvent.timestamp();
|
||||
int nbytes = implRead(b, off, len);
|
||||
SocketReadEvent.offer(start, nbytes, parent.getRemoteSocketAddress(), getSoTimeout());
|
||||
long duration = SocketReadEvent.timestamp() - start;
|
||||
if (SocketReadEvent.shouldCommit(duration)) {
|
||||
SocketReadEvent.emit(start, duration, nbytes, parent.getRemoteSocketAddress(), getSoTimeout());
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
@ -1209,7 +1212,10 @@ public class Socket implements java.io.Closeable {
|
|||
}
|
||||
long start = SocketWriteEvent.timestamp();
|
||||
implWrite(b, off, len);
|
||||
SocketWriteEvent.offer(start, len, parent.getRemoteSocketAddress());
|
||||
long duration = SocketWriteEvent.timestamp() - start;
|
||||
if (SocketWriteEvent.shouldCommit(duration)) {
|
||||
SocketWriteEvent.emit(start, duration, len, parent.getRemoteSocketAddress());
|
||||
}
|
||||
}
|
||||
|
||||
private void implWrite(byte[] b, int off, int len) throws IOException {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue