28 * @requires vm.gc.G1
29 * @requires !vm.flightRecorder
30 * @library /test/lib /
31 * @modules java.base/jdk.internal.misc
32 * @modules java.management
33 * @build jdk.test.whitebox.WhiteBox
34 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
35 * @run main/timeout=240 gc.g1.plab.TestPLABPromotion
36 */
37 package gc.g1.plab;
38
39 import java.util.List;
40 import java.util.Arrays;
41 import java.io.PrintStream;
42
43 import gc.g1.plab.lib.AppPLABPromotion;
44 import gc.g1.plab.lib.LogParser;
45 import gc.g1.plab.lib.PLABUtils;
46 import gc.g1.plab.lib.PlabInfo;
47
48 import jdk.test.lib.process.OutputAnalyzer;
49 import jdk.test.lib.process.ProcessTools;
50
51 /**
52 * Test checks PLAB promotion of different size objects.
53 */
54 public class TestPLABPromotion {
55
56 // GC ID with survivor PLAB statistics
57 private final static long GC_ID_SURVIVOR_STATS = 1l;
58 // GC ID with old PLAB statistics
59 private final static long GC_ID_OLD_STATS = 2l;
60
61 private final static String PLAB_USED_FIELD_NAME = "used";
62 private final static String PLAB_DIRECT_ALLOCATED_FIELD_NAME = "direct allocated";
63 private final static List<String> FIELDS_TO_EXTRACT = Arrays.asList(PLAB_USED_FIELD_NAME, PLAB_DIRECT_ALLOCATED_FIELD_NAME);
64
65 private static String output;
66
67 // Allowable difference for memory consumption (percentage)
68 private final static long MEM_DIFFERENCE_PCT = 5;
69
70 private static final int PLAB_SIZE_SMALL = 1024;
71 private static final int PLAB_SIZE_MEDIUM = 4096;
72 private static final int PLAB_SIZE_HIGH = 65536;
73 private static final int OBJECT_SIZE_SMALL = 10;
74 private static final int OBJECT_SIZE_MEDIUM = 100;
75 private static final int OBJECT_SIZE_HIGH = 3250;
76 private static final int GC_NUM_SMALL = 1;
77 private static final int GC_NUM_MEDIUM = 3;
78 private static final int GC_NUM_HIGH = 7;
79 private static final int WASTE_PCT_SMALL = 10;
80 private static final int WASTE_PCT_MEDIUM = 20;
81 private static final int WASTE_PCT_HIGH = 30;
82 private static final int YOUNG_SIZE_LOW = 16;
83 private static final int YOUNG_SIZE_HIGH = 64;
84 private static final boolean PLAB_FIXED = true;
85 private static final boolean PLAB_DYNAMIC = false;
86
87 private final static TestCase[] TEST_CASES = {
88 // Test cases for unreachable object, PLAB size is fixed
89 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_SMALL, OBJECT_SIZE_MEDIUM, GC_NUM_SMALL, YOUNG_SIZE_LOW, PLAB_FIXED, false, false),
90 new TestCase(WASTE_PCT_HIGH, PLAB_SIZE_MEDIUM, OBJECT_SIZE_SMALL, GC_NUM_HIGH, YOUNG_SIZE_HIGH, PLAB_FIXED, false, false),
91 // Test cases for reachable objects, PLAB size is fixed
92 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_SMALL, OBJECT_SIZE_SMALL, GC_NUM_HIGH, YOUNG_SIZE_HIGH, PLAB_FIXED, true, true),
93 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_MEDIUM, OBJECT_SIZE_MEDIUM, GC_NUM_SMALL, YOUNG_SIZE_LOW, PLAB_FIXED, true, true),
94 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_SMALL, OBJECT_SIZE_HIGH, GC_NUM_MEDIUM, YOUNG_SIZE_LOW, PLAB_FIXED, true, false),
95 new TestCase(WASTE_PCT_MEDIUM, PLAB_SIZE_HIGH, OBJECT_SIZE_SMALL, GC_NUM_HIGH, YOUNG_SIZE_HIGH, PLAB_FIXED, true, true),
|
28 * @requires vm.gc.G1
29 * @requires !vm.flightRecorder
30 * @library /test/lib /
31 * @modules java.base/jdk.internal.misc
32 * @modules java.management
33 * @build jdk.test.whitebox.WhiteBox
34 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
35 * @run main/timeout=240 gc.g1.plab.TestPLABPromotion
36 */
37 package gc.g1.plab;
38
39 import java.util.List;
40 import java.util.Arrays;
41 import java.io.PrintStream;
42
43 import gc.g1.plab.lib.AppPLABPromotion;
44 import gc.g1.plab.lib.LogParser;
45 import gc.g1.plab.lib.PLABUtils;
46 import gc.g1.plab.lib.PlabInfo;
47
48 import jdk.test.lib.Platform;
49 import jdk.test.lib.process.OutputAnalyzer;
50 import jdk.test.lib.process.ProcessTools;
51
52 /**
53 * Test checks PLAB promotion of different size objects.
54 */
55 public class TestPLABPromotion {
56
57 // GC ID with survivor PLAB statistics
58 private final static long GC_ID_SURVIVOR_STATS = 1l;
59 // GC ID with old PLAB statistics
60 private final static long GC_ID_OLD_STATS = 2l;
61
62 private final static String PLAB_USED_FIELD_NAME = "used";
63 private final static String PLAB_DIRECT_ALLOCATED_FIELD_NAME = "direct allocated";
64 private final static List<String> FIELDS_TO_EXTRACT = Arrays.asList(PLAB_USED_FIELD_NAME, PLAB_DIRECT_ALLOCATED_FIELD_NAME);
65
66 private static String output;
67
68 // Allowable difference for memory consumption (percentage)
69 private final static long MEM_DIFFERENCE_PCT = 5;
70
71 private static final int PLAB_SIZE_SMALL = 1024;
72 private static final int PLAB_SIZE_MEDIUM = 4096;
73 private static final int PLAB_SIZE_HIGH = 65536;
74 private static final int OBJECT_SIZE_SMALL = 10;
75 private static final int OBJECT_SIZE_MEDIUM = 100;
76 private static final int OBJECT_SIZE_HIGH = Platform.is64bit() ? 3266 : 3258;
77 private static final int GC_NUM_SMALL = 1;
78 private static final int GC_NUM_MEDIUM = 3;
79 private static final int GC_NUM_HIGH = 7;
80 private static final int WASTE_PCT_SMALL = 10;
81 private static final int WASTE_PCT_MEDIUM = 20;
82 private static final int WASTE_PCT_HIGH = 30;
83 private static final int YOUNG_SIZE_LOW = 16;
84 private static final int YOUNG_SIZE_HIGH = 64;
85 private static final boolean PLAB_FIXED = true;
86 private static final boolean PLAB_DYNAMIC = false;
87
88 private final static TestCase[] TEST_CASES = {
89 // Test cases for unreachable object, PLAB size is fixed
90 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_SMALL, OBJECT_SIZE_MEDIUM, GC_NUM_SMALL, YOUNG_SIZE_LOW, PLAB_FIXED, false, false),
91 new TestCase(WASTE_PCT_HIGH, PLAB_SIZE_MEDIUM, OBJECT_SIZE_SMALL, GC_NUM_HIGH, YOUNG_SIZE_HIGH, PLAB_FIXED, false, false),
92 // Test cases for reachable objects, PLAB size is fixed
93 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_SMALL, OBJECT_SIZE_SMALL, GC_NUM_HIGH, YOUNG_SIZE_HIGH, PLAB_FIXED, true, true),
94 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_MEDIUM, OBJECT_SIZE_MEDIUM, GC_NUM_SMALL, YOUNG_SIZE_LOW, PLAB_FIXED, true, true),
95 new TestCase(WASTE_PCT_SMALL, PLAB_SIZE_SMALL, OBJECT_SIZE_HIGH, GC_NUM_MEDIUM, YOUNG_SIZE_LOW, PLAB_FIXED, true, false),
96 new TestCase(WASTE_PCT_MEDIUM, PLAB_SIZE_HIGH, OBJECT_SIZE_SMALL, GC_NUM_HIGH, YOUNG_SIZE_HIGH, PLAB_FIXED, true, true),
|