hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
changeset 38133 78b95467b9f1
parent 36851 03e2f4d0a421
child 40059 c2304140ed64
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
     1 /*
     1 /*
     2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    65                         bean.getUsageThreshold(), bean.getUsage().getUsed()));
    65                         bean.getUsageThreshold(), bean.getUsage().getUsed()));
    66     }
    66     }
    67 
    67 
    68     protected void runTest() {
    68     protected void runTest() {
    69         long headerSize = CodeCacheUtils.getHeaderSize(btype);
    69         long headerSize = CodeCacheUtils.getHeaderSize(btype);
    70         long allocationUnit = CodeCacheUtils.MIN_ALLOCATION - headerSize;
    70         long allocationUnit = Math.max(0, CodeCacheUtils.MIN_ALLOCATION - headerSize);
    71         MemoryPoolMXBean bean = btype.getMemoryPool();
    71         MemoryPoolMXBean bean = btype.getMemoryPool();
    72         long initialCount = bean.getUsageThresholdCount();
    72         long initialCount = bean.getUsageThresholdCount();
    73         long initialSize = bean.getUsage().getUsed();
    73         long initialSize = bean.getUsage().getUsed();
    74         bean.setUsageThreshold(initialSize + THRESHOLD_STEP);
    74         bean.setUsageThreshold(initialSize + THRESHOLD_STEP);
    75         for (int i = 0; i < ALLOCATION_STEP - 1; i++) {
    75         for (int i = 0; i < ALLOCATION_STEP - 1; i++) {