Path: blob/master/test/hotspot/jtreg/compiler/jvmci/compilerToVM/CollectCountersTest.java
41153 views
/*1* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 813642126* @requires vm.jvmci27* @library / /test/lib/28* @library ../common/patches29* @modules java.base/jdk.internal.misc30* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot31* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox32* @run main/othervm -XX:+UnlockExperimentalVMOptions33* -XX:+EnableJVMCI34* -XX:JVMCICounterSize=035* -Dcompiler.jvmci.compilerToVM.CollectCountersTest.expected=036* compiler.jvmci.compilerToVM.CollectCountersTest37* @run main/othervm -XX:+UnlockExperimentalVMOptions38* -XX:+EnableJVMCI39* -XX:JVMCICounterSize=1140* -Dcompiler.jvmci.compilerToVM.CollectCountersTest.expected=1141* compiler.jvmci.compilerToVM.CollectCountersTest42*/4344package compiler.jvmci.compilerToVM;4546import jdk.test.lib.Asserts;47import jdk.vm.ci.hotspot.CompilerToVMHelper;4849public class CollectCountersTest {50private static final int EXPECTED = Integer.getInteger(51"compiler.jvmci.compilerToVM.CollectCountersTest.expected");52public static void main(String args[]) {53new CollectCountersTest().runTest();54}5556private void runTest() {57long[] counters = CompilerToVMHelper.collectCounters();58Asserts.assertNotNull(counters, "Expected not-null counters array");59int ctvmData = counters.length;60Asserts.assertEQ(EXPECTED, ctvmData, "Unexpected counters amount");61}62}636465