34 import jdk.jfr.Recording;
35 import jdk.jfr.consumer.RecordedEvent;
36 import jdk.test.lib.Asserts;
37 import jdk.test.lib.jfr.EventNames;
38 import jdk.test.lib.jfr.Events;
39 import sun.hotspot.WhiteBox;
40 import sun.hotspot.code.BlobType;
41 import sun.hotspot.code.CodeBlob;
42
43 /**
44 * Test for events: vm/code_sweeper/sweep vm/code_cache/full vm/compiler/failure
45 *
46 * We verify: 1. That sweptCount >= flushedCount + zombifiedCount 2. That
47 * sweepIndex increases by 1. 3. We should get at least one of each of the
48 * events listed above.
49 *
50 * NOTE! The test is usually able to trigger the events but not always. If an
51 * event is received, the event is verified. If an event is missing, we do NOT
52 * fail.
53 */
54 /*
55 * @test TestCodeSweeper
56 * @key jfr
57 * @library /test/lib
58 * @build sun.hotspot.WhiteBox
59 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
60 * sun.hotspot.WhiteBox$WhiteBoxPermission
61 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:-SegmentedCodeCache -XX:+WhiteBoxAPI jdk.jfr.event.compiler.TestCodeSweeper
62 */
63
64 public class TestCodeSweeper {
65 private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
66 private static final int COMP_LEVEL_SIMPLE = 1;
67 private static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
68 private static final int SIZE = 1;
69 private static final String METHOD_NAME = "verifyFullEvent";
70 private static final String pathSweep = EventNames.SweepCodeCache;
71 private static final String pathFull = EventNames.CodeCacheFull;
72 private static final String pathFailure = EventNames.CompilationFailure;
73 public static final long SEGMENT_SIZE = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheSegmentSize");
74 public static final long MIN_BLOCK_LENGTH = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheMinBlockLength");
75 public static final long MIN_ALLOCATION = SEGMENT_SIZE * MIN_BLOCK_LENGTH;
76 private static final double CACHE_USAGE_COEF = 0.95d;
|
34 import jdk.jfr.Recording;
35 import jdk.jfr.consumer.RecordedEvent;
36 import jdk.test.lib.Asserts;
37 import jdk.test.lib.jfr.EventNames;
38 import jdk.test.lib.jfr.Events;
39 import sun.hotspot.WhiteBox;
40 import sun.hotspot.code.BlobType;
41 import sun.hotspot.code.CodeBlob;
42
43 /**
44 * Test for events: vm/code_sweeper/sweep vm/code_cache/full vm/compiler/failure
45 *
46 * We verify: 1. That sweptCount >= flushedCount + zombifiedCount 2. That
47 * sweepIndex increases by 1. 3. We should get at least one of each of the
48 * events listed above.
49 *
50 * NOTE! The test is usually able to trigger the events but not always. If an
51 * event is received, the event is verified. If an event is missing, we do NOT
52 * fail.
53 */
54 /**
55 * @test TestCodeSweeper
56 * @key jfr
57 * @requires vm.hasJFR
58 * @library /test/lib
59 * @build sun.hotspot.WhiteBox
60 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
61 * sun.hotspot.WhiteBox$WhiteBoxPermission
62 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:-SegmentedCodeCache -XX:+WhiteBoxAPI jdk.jfr.event.compiler.TestCodeSweeper
63 */
64
65 public class TestCodeSweeper {
66 private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
67 private static final int COMP_LEVEL_SIMPLE = 1;
68 private static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
69 private static final int SIZE = 1;
70 private static final String METHOD_NAME = "verifyFullEvent";
71 private static final String pathSweep = EventNames.SweepCodeCache;
72 private static final String pathFull = EventNames.CodeCacheFull;
73 private static final String pathFailure = EventNames.CompilationFailure;
74 public static final long SEGMENT_SIZE = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheSegmentSize");
75 public static final long MIN_BLOCK_LENGTH = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheMinBlockLength");
76 public static final long MIN_ALLOCATION = SEGMENT_SIZE * MIN_BLOCK_LENGTH;
77 private static final double CACHE_USAGE_COEF = 0.95d;
|