Java Code Examples for sun.hotspot.code.BlobType#getAvailable()

The following examples show how to use sun.hotspot.code.BlobType#getAvailable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryPoolsPresenceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void runTest() {
    List<MemoryManagerMXBean> beans
            = ManagementFactory.getMemoryManagerMXBeans();
    Optional<MemoryManagerMXBean> any = beans
            .stream()
            .filter(bean -> CC_MANAGER.equals(bean.getName()))
            .findAny();
    Asserts.assertTrue(any.isPresent(), "Bean not found: " + CC_MANAGER);
    MemoryManagerMXBean ccManager = any.get();
    Asserts.assertNotNull(ccManager, "Found null for " + CC_MANAGER);
    String names[] = ccManager.getMemoryPoolNames();
    for (String name : names) {
        counters.put(name, counters.containsKey(name)
                ? counters.get(name) + 1 : 1);
    }
    for (BlobType btype : BlobType.getAvailable()) {
        Asserts.assertEQ(counters.get(btype.getMemoryPool().getName()), 1,
                "Found unexpected amount of beans for pool "
                + btype.getMemoryPool().getName());
    }
    Asserts.assertEQ(BlobType.getAvailable().size(),
            counters.keySet().size(), "Unexpected amount of bean names");
}
 
Example 2
Source File: TestCodeCacheFull.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static BlobType blobTypeFromName(String codeBlobTypeName) throws Exception {
    for (BlobType t : BlobType.getAvailable()) {
        if (t.name.equals(codeBlobTypeName)) {
            return t;
        }
    }
    throw new Exception("Unexpected event " + codeBlobTypeName);
}
 
Example 3
Source File: ThresholdNotificationsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    for (BlobType bt : BlobType.getAvailable()) {
        if (CodeCacheUtils.isCodeHeapPredictable(bt)) {
            new ThresholdNotificationsTest(bt).runTest();
        }
    }
}
 
Example 4
Source File: GetUsageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected final Map<MemoryPoolMXBean, Long> getBeanUsages() {
    Map<MemoryPoolMXBean, Long> beanUsages = new HashMap<>();
    for (BlobType bt : BlobType.getAvailable()) {
        beanUsages.put(bt.getMemoryPool(),
                bt.getMemoryPool().getUsage().getUsed());
    }
    return beanUsages;
}
 
Example 5
Source File: GetUsageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    for (BlobType btype : BlobType.getAvailable()) {
        for (int allocSize = 10; allocSize < 100000; allocSize *= 10) {
            new GetUsageTest(btype, allocSize).runTest();
        }
    }
}
 
Example 6
Source File: UsageThresholdExceededTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    int iterationsCount = Integer.getInteger("jdk.test.lib.iterations", 1);
    for (BlobType btype : BlobType.getAvailable()) {
        if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
            new UsageThresholdExceededTest(btype, iterationsCount).runTest();
        }
    }
}
 
Example 7
Source File: PoolsIndependenceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public PoolsIndependenceTest(BlobType btype) {
    counters = new HashMap<>();
    for (BlobType bt : BlobType.getAvailable()) {
        counters.put(bt.getMemoryPool().getName(), new AtomicInteger(0));
    }
    this.btype = btype;
    lastEventTimestamp = 0;
    CodeCacheUtils.disableCollectionUsageThresholds();
}
 
Example 8
Source File: TestCodeCacheFull.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static long calculateAvailableSize(BlobType btype) {
    long availableSize = btype.getSize();
    for (BlobType alternative : BlobType.getAvailable()) {
        if (btype.allowTypeWhenOverflow(alternative)) {
            availableSize = Math.max(availableSize, alternative.getSize());
        }
    }
    return availableSize;
}
 
Example 9
Source File: TestCodeCacheFull.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static BlobType blobTypeFromName(String codeBlobTypeName) throws Exception {
    for (BlobType t : BlobType.getAvailable()) {
        if (t.name.equals(codeBlobTypeName)) {
            return t;
        }
    }
    throw new Exception("Unexpected event " + codeBlobTypeName);
}
 
Example 10
Source File: TestCodeCacheFull.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static long calculateAvailableSize(BlobType btype) {
    long availableSize = btype.getSize();
    for (BlobType alternative : BlobType.getAvailable()) {
        if (btype.allowTypeWhenOverflow(alternative)) {
            availableSize = Math.max(availableSize, alternative.getSize());
        }
    }
    return availableSize;
}
 
Example 11
Source File: ForceNMethodSweepTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private ForceNMethodSweepTest(TestCase testCase) {
    super(testCase);
    // to prevent inlining of #method
    WHITE_BOX.testSetDontInlineMethod(method, true);
    blobTypes = BlobType.getAvailable();
}
 
Example 12
Source File: UsageThresholdIncreasedTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    for (BlobType btype : BlobType.getAvailable()) {
        new UsageThresholdIncreasedTest(btype).runTest();
    }
}
 
Example 13
Source File: GetCodeHeapEntriesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    EnumSet<BlobType> blobTypes = BlobType.getAvailable();
    for (BlobType type : blobTypes) {
        new GetCodeHeapEntriesTest(type).test();
    }
}
 
Example 14
Source File: PoolsIndependenceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    for (BlobType bt : BlobType.getAvailable()) {
        new PoolsIndependenceTest(bt).runTest();
    }
}
 
Example 15
Source File: PoolsIndependenceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected void runTest() {
    MemoryPoolMXBean bean = btype.getMemoryPool();
    ((NotificationEmitter) ManagementFactory.getMemoryMXBean()).
            addNotificationListener(this, null, null);
    bean.setUsageThreshold(bean.getUsage().getUsed() + 1);
    long beginTimestamp = System.currentTimeMillis();
    CodeCacheUtils.WB.allocateCodeBlob(
            CodeCacheUtils.ALLOCATION_SIZE, btype.id);
    CodeCacheUtils.WB.fullGC();
    /* waiting for expected event to be received plus double the time took
     to receive expected event(for possible unexpected) and
     plus 1 second in case expected event received (almost)immediately */
    Utils.waitForCondition(() -> {
        long currentTimestamp = System.currentTimeMillis();
        int eventsCount
                = counters.get(btype.getMemoryPool().getName()).get();
        if (eventsCount > 0) {
            if (eventsCount > 1) {
                return true;
            }
            long timeLastEventTook
                    = beginTimestamp - lastEventTimestamp;
            long timeoutValue
                    = 1000L + beginTimestamp + 3L * timeLastEventTook;
            return currentTimestamp > timeoutValue;
        }
        return false;
    });
    for (BlobType bt : BlobType.getAvailable()) {
        int expectedNotificationsAmount = bt.equals(btype) ? 1 : 0;
        CodeCacheUtils.assertEQorGTE(btype, counters.get(bt.getMemoryPool().getName()).get(),
                expectedNotificationsAmount, String.format("Unexpected "
                        + "amount of notifications for pool: %s",
                        bt.getMemoryPool().getName()));
    }
    try {
        ((NotificationEmitter) ManagementFactory.getMemoryMXBean()).
                removeNotificationListener(this);
    } catch (ListenerNotFoundException ex) {
        throw new AssertionError("Can't remove notification listener", ex);
    }
    System.out.printf("INFO: Scenario with %s finished%n", bean.getName());
}
 
Example 16
Source File: ManagerNamesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) {
    for (BlobType btype : BlobType.getAvailable()) {
        new ManagerNamesTest(btype).runTest();
    }
}
 
Example 17
Source File: BeanTypeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) {
    for (BlobType bt : BlobType.getAvailable()) {
        Asserts.assertEQ(MemoryType.NON_HEAP, bt.getMemoryPool().getType());
    }
}
 
Example 18
Source File: TestCodeCacheFull.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    for (BlobType btype : BlobType.getAvailable()) {
        testWithBlobType(btype, calculateAvailableSize(btype));
    }
}
 
Example 19
Source File: UsageThresholdNotExceededTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    for (BlobType btype : BlobType.getAvailable()) {
        new UsageThresholdNotExceededTest(btype).runTest();
    }
}
 
Example 20
Source File: OverflowCodeCacheTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    EnumSet<BlobType> blobTypes = BlobType.getAvailable();
    for (BlobType type : blobTypes) {
        new OverflowCodeCacheTest(type).test();
    }
}