--- old/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java 2019-08-12 15:08:05.000000000 -0700 +++ new/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java 2019-08-12 15:08:05.000000000 -0700 @@ -20,14 +20,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import jdk.jfr.Event; import jdk.jfr.Description; import jdk.jfr.Label; -// This class generates simple event in a loop -// for a specified time. -// Pass the time in seconds as a parameter. +// This class generates simple event in a loop for a specified time. public class EventGeneratorLoop { @Label("SimpleEvent") @@ -41,12 +43,19 @@ } + // Arguments: + // - time to run (in seconds) - mandatory + // - full file path to signal the start of main - optional public static void main(String[] args) throws Exception { if ((args.length < 1) || (args[0] == null)) { throw new IllegalArgumentException("Expecting one argument: time to run (seconds)"); } int howLong = Integer.parseInt(args[0]); + if ((args.length > 1) && (args[1] != null)) { + signalStartOfMain(args[1]); + } + for (int i=0; i < howLong; i++) { SimpleEvent ev = new SimpleEvent(); ev.msg = "Hello"; @@ -57,4 +66,10 @@ System.out.print("."); } } + + private static void signalStartOfMain(String fileName) throws Exception { + Path p = Paths.get(fileName); + Files.createFile(p); + p.toFile().deleteOnExit(); +} }