blob: f85d3eeae9aa55fe9860358c4e37a40852c86d7e [file] [log] [blame]
Aurimas Liutikas88c7ff12023-08-10 12:42:26 -07001/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16// This file is generated by generate_java.py do not directly modify!
17package android.libcore.varhandles;
18
19import android.perftests.utils.BenchmarkState;
20import android.perftests.utils.PerfStatusReporter;
21import android.test.suitebuilder.annotation.LargeTest;
22
23import androidx.test.runner.AndroidJUnit4;
24
25import org.junit.Rule;
26import org.junit.Test;
27import org.junit.runner.RunWith;
28
29import java.lang.invoke.MethodHandles;
30import java.lang.invoke.VarHandle;
31
32@RunWith(AndroidJUnit4.class)
33@LargeTest
34public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest {
35 @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
36 static final int FIELD_VALUE = 42;
37 static int sField = FIELD_VALUE;
38 VarHandle mVh;
39
40 public VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable {
41 mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class);
42 }
43
44 @Test
45 public void run() {
46 int x;
47 BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
48 while (state.keepRunning()) {
49 x = (int) mVh.getAndBitwiseAndRelease(~42);
50 x = (int) mVh.getAndBitwiseAndRelease(~42);
51 }
52 }
53}