8329138: Convert JFR FileForceEvent to static mirror event

Reviewed-by: alanb, egahlin
This commit is contained in:
Tim Prinzing 2024-04-30 15:39:23 +00:00 committed by Alan Bateman
parent 2cc8eccb36
commit f4caac8dea
12 changed files with 252 additions and 42 deletions

View file

@ -50,6 +50,7 @@ import java.util.Objects;
import jdk.internal.access.JavaIOFileDescriptorAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.event.FileForceEvent;
import jdk.internal.foreign.MemorySessionImpl;
import jdk.internal.foreign.SegmentFactories;
import jdk.internal.misc.Blocker;
@ -486,8 +487,7 @@ public class FileChannelImpl
}
}
@Override
public void force(boolean metaData) throws IOException {
private void implForce(boolean metaData) throws IOException {
ensureOpen();
int rv = -1;
int ti = -1;
@ -511,6 +511,17 @@ public class FileChannelImpl
}
}
@Override
public void force(boolean metaData) throws IOException {
if (!FileForceEvent.enabled()) {
implForce(metaData);
return;
}
long start = FileForceEvent.timestamp();
implForce(metaData);
FileForceEvent.offer(start, path, metaData);
}
// Assume at first that the underlying kernel supports sendfile/equivalent;
// set this to true if we find out later that it doesn't
//