CollectCountersTest.java revision 11707:ad7af1afda7a
11590Srgrimes/* 21590Srgrimes * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 31590Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41590Srgrimes * 51590Srgrimes * This code is free software; you can redistribute it and/or modify it 61590Srgrimes * under the terms of the GNU General Public License version 2 only, as 71590Srgrimes * published by the Free Software Foundation. 81590Srgrimes * 91590Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 101590Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 111590Srgrimes * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 121590Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 131590Srgrimes * accompanied this code). 141590Srgrimes * 151590Srgrimes * You should have received a copy of the GNU General Public License version 161590Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 171590Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 181590Srgrimes * 191590Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 201590Srgrimes * or visit www.oracle.com if you need additional information or have any 211590Srgrimes * questions. 221590Srgrimes */ 231590Srgrimes 241590Srgrimes/* 251590Srgrimes * @test 261590Srgrimes * @bug 8136421 271590Srgrimes * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") 281590Srgrimes * @library / /testlibrary /test/lib/ 291590Srgrimes * @library ../common/patches 301590Srgrimes * @modules java.base/jdk.internal.misc 311590Srgrimes * @modules jdk.vm.ci/jdk.vm.ci.hotspot 321590Srgrimes * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper 331590Srgrimes * @build compiler.jvmci.compilerToVM.CollectCountersTest 3487701Smarkm * @run main/othervm -XX:+UnlockExperimentalVMOptions 3587701Smarkm * -XX:+EnableJVMCI 3687701Smarkm * -XX:JVMCICounterSize=0 3787701Smarkm * -Dcompiler.jvmci.compilerToVM.CollectCountersTest.expected=0 381590Srgrimes * compiler.jvmci.compilerToVM.CollectCountersTest 3987701Smarkm * @run main/othervm -XX:+UnlockExperimentalVMOptions 4028370Scharnier * -XX:+EnableJVMCI 411590Srgrimes * -XX:JVMCICounterSize=11 4287701Smarkm * -Dcompiler.jvmci.compilerToVM.CollectCountersTest.expected=11 431590Srgrimes * compiler.jvmci.compilerToVM.CollectCountersTest 441590Srgrimes */ 4587701Smarkm 461590Srgrimespackage compiler.jvmci.compilerToVM; 471590Srgrimes 481590Srgrimesimport jdk.test.lib.Asserts; 491590Srgrimesimport jdk.vm.ci.hotspot.CompilerToVMHelper; 5092922Simp 511590Srgrimespublic class CollectCountersTest { 521590Srgrimes private static final int EXPECTED = Integer.getInteger( 531590Srgrimes "compiler.jvmci.compilerToVM.CollectCountersTest.expected"); 541590Srgrimes public static void main(String args[]) { 551590Srgrimes new CollectCountersTest().runTest(); 561590Srgrimes } 571590Srgrimes 581590Srgrimes private void runTest() { 591590Srgrimes long[] counters = CompilerToVMHelper.collectCounters(); 601590Srgrimes Asserts.assertNotNull(counters, "Expected not-null counters array"); 611590Srgrimes int ctvmData = counters.length; 621590Srgrimes Asserts.assertEQ(EXPECTED, ctvmData, "Unexpected counters amount"); 631590Srgrimes } 641590Srgrimes} 651590Srgrimes