diff -r 2c3cc4b01880 -r c16ac7a2eba4 src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java Wed Oct 30 16:14:56 2019 +0100 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java Wed Oct 30 19:43:52 2019 +0100 @@ -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 @@ -81,7 +81,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) + @@ -90,6 +90,7 @@ ", disk=" + disk+ ", filename=" + path + ", maxage=" + maxAge + + ", flush=" + flush + ", maxsize=" + maxSize + ", dumponexit =" + dumpOnExit + ", path-to-gc-roots=" + pathToGcRoots); @@ -136,6 +137,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); } @@ -148,6 +155,7 @@ if (disk != null) { recording.setToDisk(disk.booleanValue()); } + recording.setSettings(s); SafePath safePath = null; @@ -177,6 +185,10 @@ recording.setMaxAge(Duration.ofNanos(maxAge)); } + if (flush != null) { + recording.setFlushInterval(Duration.ofNanos(flush)); + } + if (maxSize != null) { recording.setMaxSize(maxSize); } @@ -222,6 +234,7 @@ print("Use jcmd " + getPid() + " JFR." + cmd + " " + recordingspecifier + " " + fileOption + "to copy recording data to file."); println(); } + return getResult(); }