mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +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
|
@ -494,7 +494,10 @@ class SocketChannelImpl
|
|||
}
|
||||
long start = SocketReadEvent.timestamp();
|
||||
int nbytes = implRead(buf);
|
||||
SocketReadEvent.offer(start, nbytes, remoteAddress(), 0);
|
||||
long duration = SocketReadEvent.timestamp() - start;
|
||||
if (SocketReadEvent.shouldCommit(duration)) {
|
||||
SocketReadEvent.emit(start, duration, nbytes, remoteAddress(), 0);
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
@ -508,7 +511,10 @@ class SocketChannelImpl
|
|||
}
|
||||
long start = SocketReadEvent.timestamp();
|
||||
long nbytes = implRead(dsts, offset, length);
|
||||
SocketReadEvent.offer(start, nbytes, remoteAddress(), 0);
|
||||
long duration = SocketReadEvent.timestamp() - start;
|
||||
if (SocketReadEvent.shouldCommit(duration)) {
|
||||
SocketReadEvent.emit(start, duration, nbytes, remoteAddress(), 0);
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
@ -619,7 +625,10 @@ class SocketChannelImpl
|
|||
}
|
||||
long start = SocketWriteEvent.timestamp();
|
||||
int nbytes = implWrite(buf);
|
||||
SocketWriteEvent.offer(start, nbytes, remoteAddress());
|
||||
long duration = SocketWriteEvent.timestamp() - start;
|
||||
if (SocketWriteEvent.shouldCommit(duration)) {
|
||||
SocketWriteEvent.emit(start, duration, nbytes, remoteAddress());
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
@ -632,7 +641,10 @@ class SocketChannelImpl
|
|||
}
|
||||
long start = SocketWriteEvent.timestamp();
|
||||
long nbytes = implWrite(srcs, offset, length);
|
||||
SocketWriteEvent.offer(start, nbytes, remoteAddress());
|
||||
long duration = SocketWriteEvent.timestamp() - start;
|
||||
if (SocketWriteEvent.shouldCommit(duration)) {
|
||||
SocketWriteEvent.emit(start, duration, nbytes, remoteAddress());
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue