24 */
25
26 package jdk.jfr.jcmd;
27
28 import java.io.File;
29 import java.io.IOException;
30 import java.util.ArrayList;
31 import java.util.Collections;
32 import java.util.HashMap;
33 import java.util.List;
34 import java.util.Map;
35
36 import jdk.jfr.Enabled;
37 import jdk.jfr.Recording;
38 import jdk.jfr.consumer.RecordedEvent;
39 import jdk.jfr.consumer.RecordedObject;
40 import jdk.jfr.consumer.RecordingFile;
41 import jdk.jfr.internal.test.WhiteBox;
42 import jdk.test.lib.jfr.EventNames;
43
44 /*
45 * @test
46 * @summary Start a recording with or without path-to-gc-roots
47 * @modules jdk.jfr/jdk.jfr.internal.test
48 * @library /test/lib /test/jdk
49 * @key jfr
50 *
51 * @run main/othervm -XX:TLABSize=2k jdk.jfr.jcmd.TestJcmdDumpPathToGCRoots
52 */
53 public class TestJcmdDumpPathToGCRoots {
54
55 private static final int OBJECT_COUNT = 100_000;
56 public static List<Object[]> leak = new ArrayList<>(OBJECT_COUNT);
57
58 public static void main(String[] args) throws Exception {
59 WhiteBox.setWriteAllObjectSamples(true);
60
61 String settingName = EventNames.OldObjectSample + "#" + "cutoff";
62
63 // dump parameter trumps previous setting
64 testDump("path-to-gc-roots=true", Collections.singletonMap(settingName, "infinity"), true);
65 testDump("path-to-gc-roots=true", Collections.singletonMap(settingName, "0 ns"), true);
66 testDump("path-to-gc-roots=true", Collections.emptyMap(), true);
|
24 */
25
26 package jdk.jfr.jcmd;
27
28 import java.io.File;
29 import java.io.IOException;
30 import java.util.ArrayList;
31 import java.util.Collections;
32 import java.util.HashMap;
33 import java.util.List;
34 import java.util.Map;
35
36 import jdk.jfr.Enabled;
37 import jdk.jfr.Recording;
38 import jdk.jfr.consumer.RecordedEvent;
39 import jdk.jfr.consumer.RecordedObject;
40 import jdk.jfr.consumer.RecordingFile;
41 import jdk.jfr.internal.test.WhiteBox;
42 import jdk.test.lib.jfr.EventNames;
43
44 /**
45 * @test
46 * @summary Start a recording with or without path-to-gc-roots
47 * @requires vm.hasJFR
48 * @modules jdk.jfr/jdk.jfr.internal.test
49 * @library /test/lib /test/jdk
50 * @key jfr
51 *
52 * @run main/othervm -XX:TLABSize=2k jdk.jfr.jcmd.TestJcmdDumpPathToGCRoots
53 */
54 public class TestJcmdDumpPathToGCRoots {
55
56 private static final int OBJECT_COUNT = 100_000;
57 public static List<Object[]> leak = new ArrayList<>(OBJECT_COUNT);
58
59 public static void main(String[] args) throws Exception {
60 WhiteBox.setWriteAllObjectSamples(true);
61
62 String settingName = EventNames.OldObjectSample + "#" + "cutoff";
63
64 // dump parameter trumps previous setting
65 testDump("path-to-gc-roots=true", Collections.singletonMap(settingName, "infinity"), true);
66 testDump("path-to-gc-roots=true", Collections.singletonMap(settingName, "0 ns"), true);
67 testDump("path-to-gc-roots=true", Collections.emptyMap(), true);
|