提交 a0166f4d 编写于 作者: M mgronlun

8215284: Reduce noise induced by periodic task getFileSize()

Reviewed-by: redestad, egahlin
上级 e1f1cc9d
...@@ -517,4 +517,11 @@ public final class JVM { ...@@ -517,4 +517,11 @@ public final class JVM {
* @param emitAll emit all samples in old object queue * @param emitAll emit all samples in old object queue
*/ */
public native void emitOldObjectSamples(long cutoff, boolean emitAll); public native void emitOldObjectSamples(long cutoff, boolean emitAll);
/**
* Test if a chunk rotation is warranted.
*
* @return if it is time to perform a chunk rotation
*/
public native boolean shouldRotateDisk();
} }
...@@ -428,20 +428,14 @@ public final class PlatformRecorder { ...@@ -428,20 +428,14 @@ public final class PlatformRecorder {
} }
private void periodicTask() { private void periodicTask() {
while (true) {
synchronized (this) {
if (!jvm.hasNativeJFR()) { if (!jvm.hasNativeJFR()) {
return; return;
} }
if (currentChunk != null) { while (true) {
try { synchronized (this) {
if (SecuritySupport.getFileSize(currentChunk.getUnfishedFile()) > Options.getMaxChunkSize()) { if (jvm.shouldRotateDisk()) {
rotateDisk(); rotateDisk();
} }
} catch (IOException e) {
Logger.log(JFR_SYSTEM, WARN, "Could not check file size to determine chunk rotation");
}
}
} }
long minDelta = RequestEngine.doPeriodic(); long minDelta = RequestEngine.doPeriodic();
long wait = Math.min(minDelta, Options.getWaitInterval()); long wait = Math.min(minDelta, Options.getWaitInterval());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册