< prev index next >

test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java

Print this page

 24 package jdk.jfr.jcmd;
 25 
 26 import java.io.File;
 27 import java.io.IOException;
 28 import java.util.ArrayList;
 29 import java.util.Collections;
 30 import java.util.HashMap;
 31 import java.util.List;
 32 import java.util.Map;
 33 
 34 import jdk.jfr.Enabled;
 35 import jdk.jfr.Recording;
 36 import jdk.jfr.consumer.RecordedEvent;
 37 import jdk.jfr.consumer.RecordedObject;
 38 import jdk.jfr.consumer.RecordingFile;
 39 import jdk.jfr.internal.test.WhiteBox;
 40 import jdk.test.lib.jfr.EventNames;
 41 
 42 /**
 43  * @test
 44  * @summary Start a recording with or without path-to-gc-roots
 45  * @requires vm.hasJFR


 46  * @modules jdk.jfr/jdk.jfr.internal.test
 47  * @library /test/lib /test/jdk
 48  * @requires vm.flagless
 49  *
 50  * @run main/othervm -XX:TLABSize=2k jdk.jfr.jcmd.TestJcmdDumpPathToGCRoots
 51  */
 52 public class TestJcmdDumpPathToGCRoots {
 53 
 54     private static final int OBJECT_COUNT = 100_000;
 55     public static List<Object[]> leak = new ArrayList<>(OBJECT_COUNT);
 56 
 57     public static void main(String[] args) throws Exception {
 58         WhiteBox.setWriteAllObjectSamples(true);
 59 
 60         String settingName = EventNames.OldObjectSample + "#" + "cutoff";
 61 
 62         // dump parameter trumps previous setting
 63         testDump("path-to-gc-roots=true", Collections.singletonMap(settingName, "infinity"), true);
 64         testDump("path-to-gc-roots=true", Collections.singletonMap(settingName, "0 ns"), true);
 65         testDump("path-to-gc-roots=true", Collections.emptyMap(), true);
 66 
 67         testDump("path-to-gc-roots=false", Collections.singletonMap(settingName, "infinity"), false);
 68         testDump("path-to-gc-roots=false", Collections.singletonMap(settingName, "0 ns"), false);

 24 package jdk.jfr.jcmd;
 25 
 26 import java.io.File;
 27 import java.io.IOException;
 28 import java.util.ArrayList;
 29 import java.util.Collections;
 30 import java.util.HashMap;
 31 import java.util.List;
 32 import java.util.Map;
 33 
 34 import jdk.jfr.Enabled;
 35 import jdk.jfr.Recording;
 36 import jdk.jfr.consumer.RecordedEvent;
 37 import jdk.jfr.consumer.RecordedObject;
 38 import jdk.jfr.consumer.RecordingFile;
 39 import jdk.jfr.internal.test.WhiteBox;
 40 import jdk.test.lib.jfr.EventNames;
 41 
 42 /**
 43  * @test
 44  * @requires vm.flagless
 45  * @requires vm.hasJFR
 46  * @requires !(vm.opt.final.UseCompactObjectHeaders == true | vm.opt.final.UseShenandoahGC == true)
 47  * @summary Start a recording with or without path-to-gc-roots
 48  * @modules jdk.jfr/jdk.jfr.internal.test
 49  * @library /test/lib /test/jdk

 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);
 67 
 68         testDump("path-to-gc-roots=false", Collections.singletonMap(settingName, "infinity"), false);
 69         testDump("path-to-gc-roots=false", Collections.singletonMap(settingName, "0 ns"), false);
< prev index next >