< prev index next >

test/jdk/jdk/jfr/startupargs/TestStartDuration.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.startupargs;
  27 
  28 import java.time.Duration;
  29 
  30 import jdk.jfr.Recording;
  31 import jdk.jfr.RecordingState;
  32 import jdk.test.lib.Asserts;
  33 import jdk.test.lib.jfr.CommonHelper;
  34 import jdk.test.lib.process.OutputAnalyzer;
  35 import jdk.test.lib.process.ProcessTools;
  36 
  37 /*
  38  * @test
  39  * @summary Start a recording with duration. Verify recording stops.
  40  * @key jfr

  41  * @library /test/lib /test/jdk
  42  * @run main jdk.jfr.startupargs.TestStartDuration
  43  */
  44 public class TestStartDuration {
  45 
  46     public static class TestValues {
  47         public static void main(String[] args) throws Exception {
  48             Recording r = StartupHelper.getRecording("TestStartDuration");
  49             Asserts.assertEquals(r.getDuration(), Duration.parse(args[0]));
  50             if (args.length > 1 && args[1].equals("wait")) {
  51                 CommonHelper.waitForRecordingState(r, RecordingState.STOPPED);
  52             }
  53         }
  54     }
  55 
  56     private static void testDurationInRange(String duration, Duration durationString, boolean wait) throws Exception {
  57         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
  58             "-XX:StartFlightRecording=name=TestStartDuration,duration=" + duration, TestValues.class.getName(),
  59             durationString.toString(), wait ? "wait" : "");
  60         OutputAnalyzer out = ProcessTools.executeProcess(pb);




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.startupargs;
  27 
  28 import java.time.Duration;
  29 
  30 import jdk.jfr.Recording;
  31 import jdk.jfr.RecordingState;
  32 import jdk.test.lib.Asserts;
  33 import jdk.test.lib.jfr.CommonHelper;
  34 import jdk.test.lib.process.OutputAnalyzer;
  35 import jdk.test.lib.process.ProcessTools;
  36 
  37 /**
  38  * @test
  39  * @summary Start a recording with duration. Verify recording stops.
  40  * @key jfr
  41  * @requires vm.hasJFR
  42  * @library /test/lib /test/jdk
  43  * @run main jdk.jfr.startupargs.TestStartDuration
  44  */
  45 public class TestStartDuration {
  46 
  47     public static class TestValues {
  48         public static void main(String[] args) throws Exception {
  49             Recording r = StartupHelper.getRecording("TestStartDuration");
  50             Asserts.assertEquals(r.getDuration(), Duration.parse(args[0]));
  51             if (args.length > 1 && args[1].equals("wait")) {
  52                 CommonHelper.waitForRecordingState(r, RecordingState.STOPPED);
  53             }
  54         }
  55     }
  56 
  57     private static void testDurationInRange(String duration, Duration durationString, boolean wait) throws Exception {
  58         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
  59             "-XX:StartFlightRecording=name=TestStartDuration,duration=" + duration, TestValues.class.getName(),
  60             durationString.toString(), wait ? "wait" : "");
  61         OutputAnalyzer out = ProcessTools.executeProcess(pb);


< prev index next >