blob: f4c059c58b306282f451c3c279ff62b4caf2f970 [file] [log] [blame]
Mathieu Chartier14f8b132015-09-22 18:14:29 -07001/*
2 * Copyright (C) 2015 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
17import com.google.caliper.SimpleBenchmark;
18
19public class JObjectBenchmark extends SimpleBenchmark {
20 public JObjectBenchmark() {
21 // Make sure to link methods before benchmark starts.
22 System.loadLibrary("artbenchmark");
23 timeAddRemoveLocal(1);
24 timeDecodeLocal(1);
25 timeAddRemoveGlobal(1);
26 timeDecodeGlobal(1);
27 timeAddRemoveWeakGlobal(1);
28 timeDecodeWeakGlobal(1);
29 timeDecodeHandleScopeRef(1);
30 }
31
32 public native void timeAddRemoveLocal(int reps);
33 public native void timeDecodeLocal(int reps);
34 public native void timeAddRemoveGlobal(int reps);
35 public native void timeDecodeGlobal(int reps);
36 public native void timeAddRemoveWeakGlobal(int reps);
37 public native void timeDecodeWeakGlobal(int reps);
38 public native void timeDecodeHandleScopeRef(int reps);
39}