--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java Fri May 17 15:53:21 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java Fri May 17 16:02:27 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
* @throws DCmdException if recording could not be started
*/
@SuppressWarnings("resource")
- public String execute(String name, String[] settings, Long delay, Long duration, Boolean disk, String path, Long maxAge, Long maxSize, Boolean dumpOnExit, Boolean pathToGcRoots) throws DCmdException {
+ public String execute(String name, String[] settings, Long delay, Long duration, Boolean disk, String path, Long maxAge, Long maxSize, Long flush, Boolean dumpOnExit, Boolean pathToGcRoots) throws DCmdException {
if (Logger.shouldLog(LogTag.JFR_DCMD, LogLevel.DEBUG)) {
Logger.log(LogTag.JFR_DCMD, LogLevel.DEBUG, "Executing DCmdStart: name=" + name +
", settings=" + Arrays.asList(settings) +
@@ -89,6 +89,7 @@
", disk=" + disk+
", filename=" + path +
", maxage=" + maxAge +
+ ", flush=" + flush +
", maxsize=" + maxSize +
", dumponexit =" + dumpOnExit +
", path-to-gc-roots=" + pathToGcRoots);
@@ -131,6 +132,12 @@
}
}
+ if (flush != null) {
+ if (Boolean.FALSE.equals(disk)) {
+ throw new DCmdException("Flush can only be set for recordings that are to disk.");
+ }
+ }
+
if (!FlightRecorder.isInitialized() && delay == null) {
initializeWithForcedInstrumentation(s);
}
@@ -143,6 +150,7 @@
if (disk != null) {
recording.setToDisk(disk.booleanValue());
}
+
recording.setSettings(s);
SafePath safePath = null;
@@ -172,6 +180,10 @@
recording.setMaxAge(Duration.ofNanos(maxAge));
}
+ if (flush != null) {
+ recording.setFlushInterval(Duration.ofNanos(flush));
+ }
+
if (maxSize != null) {
recording.setMaxSize(maxSize);
}