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.api.flightrecorder;
27
28 import static jdk.test.lib.Asserts.assertEquals;
29 import static jdk.test.lib.Asserts.assertTrue;
30
31 import java.time.Duration;
32 import java.util.Map;
33
34 import jdk.jfr.Event;
35 import jdk.jfr.EventType;
36 import jdk.jfr.Recording;
37
38 /*
39 * @test
40 * @key jfr
41 * @library /test/lib
42 * @run main/othervm jdk.jfr.api.flightrecorder.TestGetSettings
43 */
44 public class TestGetSettings {
45
46 public static void main(String[] args) throws Throwable {
47 final long minThresholdNanos = 1000000;
48 final String dummyEventPath = "mydummy/event/path";
49 final String myEventSettingName = String.valueOf(EventType.getEventType(MyEvent.class).getId());
50 System.out.println("myEventSettingName=" + myEventSettingName);
51
52 // Settings should be merged to include the most number of events (minimum threshold).
53 Recording r1 = new Recording();
54 r1.enable(MyEvent.class).withThreshold(Duration.ofNanos(minThresholdNanos * 3));
55 r1.enable(MyEvent.class).withThreshold(Duration.ofNanos(minThresholdNanos * 2));
56 r1.enable(dummyEventPath).withThreshold(Duration.ofNanos(minThresholdNanos));
57 r1.start();
58
59 ExpectedSetting[] expectedR1 = {
60 new ExpectedSetting(myEventSettingName, "enabled", "true"),
|
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.api.flightrecorder;
27
28 import static jdk.test.lib.Asserts.assertEquals;
29 import static jdk.test.lib.Asserts.assertTrue;
30
31 import java.time.Duration;
32 import java.util.Map;
33
34 import jdk.jfr.Event;
35 import jdk.jfr.EventType;
36 import jdk.jfr.Recording;
37
38 /**
39 * @test
40 * @key jfr
41 * @requires vm.hasJFR
42 * @library /test/lib
43 * @run main/othervm jdk.jfr.api.flightrecorder.TestGetSettings
44 */
45 public class TestGetSettings {
46
47 public static void main(String[] args) throws Throwable {
48 final long minThresholdNanos = 1000000;
49 final String dummyEventPath = "mydummy/event/path";
50 final String myEventSettingName = String.valueOf(EventType.getEventType(MyEvent.class).getId());
51 System.out.println("myEventSettingName=" + myEventSettingName);
52
53 // Settings should be merged to include the most number of events (minimum threshold).
54 Recording r1 = new Recording();
55 r1.enable(MyEvent.class).withThreshold(Duration.ofNanos(minThresholdNanos * 3));
56 r1.enable(MyEvent.class).withThreshold(Duration.ofNanos(minThresholdNanos * 2));
57 r1.enable(dummyEventPath).withThreshold(Duration.ofNanos(minThresholdNanos));
58 r1.start();
59
60 ExpectedSetting[] expectedR1 = {
61 new ExpectedSetting(myEventSettingName, "enabled", "true"),
|