31 * contain rtm locking statistics when it should not.
32 * @library /test/lib /
33 * @modules java.base/jdk.internal.misc
34 * java.management
35 * @build sun.hotspot.WhiteBox
36 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
37 * sun.hotspot.WhiteBox$WhiteBoxPermission
38 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
39 * -XX:+WhiteBoxAPI
40 * compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
41 */
42
43
44 package compiler.rtm.print;
45
46 import compiler.testlibrary.rtm.AbortProvoker;
47 import compiler.testlibrary.rtm.AbortType;
48 import compiler.testlibrary.rtm.RTMLockingStatistics;
49 import compiler.testlibrary.rtm.RTMTestBase;
50 import compiler.testlibrary.rtm.predicate.SupportedCPU;
51 import compiler.testlibrary.rtm.predicate.SupportedVM;
52 import jdk.test.lib.Asserts;
53 import jdk.test.lib.process.OutputAnalyzer;
54 import jdk.test.lib.cli.CommandLineOptionTest;
55 import jdk.test.lib.cli.predicate.AndPredicate;
56
57 import java.util.Collections;
58 import java.util.LinkedList;
59 import java.util.List;
60
61 /**
62 * Test verifies that VM output does not contain RTM locking statistics when it
63 * should not (when PrintPreciseRTMLockingStatistics is off) and that with
64 * -XX:+PrintPreciseRTMLockingStatistics locking statistics contains sane
65 * total locks and aborts count as well as for specific abort types.
66 */
67 public class TestPrintPreciseRTMLockingStatistics
68 extends CommandLineOptionTest {
69 private TestPrintPreciseRTMLockingStatistics() {
70 super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
71 }
72
73 @Override
74 public void runTestCases() throws Throwable {
75 verifyNoStatistics();
76 verifyStatistics();
77 }
78
79 // verify that VM output does not contain
80 // rtm locking statistics
81 private void verifyNoStatistics() throws Throwable {
82 verifyNoStatistics(AbortType.XABORT);
83
84 verifyNoStatistics(AbortType.XABORT,
85 "-XX:-PrintPreciseRTMLockingStatistics");
86
87 verifyNoStatistics(AbortType.XABORT, "-XX:-UseRTMLocking",
88 "-XX:+PrintPreciseRTMLockingStatistics");
89 }
90
|
31 * contain rtm locking statistics when it should not.
32 * @library /test/lib /
33 * @modules java.base/jdk.internal.misc
34 * java.management
35 * @build sun.hotspot.WhiteBox
36 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
37 * sun.hotspot.WhiteBox$WhiteBoxPermission
38 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
39 * -XX:+WhiteBoxAPI
40 * compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
41 */
42
43
44 package compiler.rtm.print;
45
46 import compiler.testlibrary.rtm.AbortProvoker;
47 import compiler.testlibrary.rtm.AbortType;
48 import compiler.testlibrary.rtm.RTMLockingStatistics;
49 import compiler.testlibrary.rtm.RTMTestBase;
50 import compiler.testlibrary.rtm.predicate.SupportedCPU;
51 import compiler.testlibrary.rtm.predicate.SupportedOS;
52 import compiler.testlibrary.rtm.predicate.SupportedVM;
53 import jdk.test.lib.Asserts;
54 import jdk.test.lib.process.OutputAnalyzer;
55 import jdk.test.lib.cli.CommandLineOptionTest;
56 import jdk.test.lib.cli.predicate.AndPredicate;
57
58 import java.util.Collections;
59 import java.util.LinkedList;
60 import java.util.List;
61
62 /**
63 * Test verifies that VM output does not contain RTM locking statistics when it
64 * should not (when PrintPreciseRTMLockingStatistics is off) and that with
65 * -XX:+PrintPreciseRTMLockingStatistics locking statistics contains sane
66 * total locks and aborts count as well as for specific abort types.
67 */
68 public class TestPrintPreciseRTMLockingStatistics
69 extends CommandLineOptionTest {
70 private TestPrintPreciseRTMLockingStatistics() {
71 super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
72 }
73
74 @Override
75 public void runTestCases() throws Throwable {
76 verifyNoStatistics();
77 verifyStatistics();
78 }
79
80 // verify that VM output does not contain
81 // rtm locking statistics
82 private void verifyNoStatistics() throws Throwable {
83 verifyNoStatistics(AbortType.XABORT);
84
85 verifyNoStatistics(AbortType.XABORT,
86 "-XX:-PrintPreciseRTMLockingStatistics");
87
88 verifyNoStatistics(AbortType.XABORT, "-XX:-UseRTMLocking",
89 "-XX:+PrintPreciseRTMLockingStatistics");
90 }
91
|