1/* 2 * Copyright (C) 2010 Google Inc. 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 17package benchmarks.regression; 18 19import org.apache.harmony.dalvik.NativeTestTarget; 20 21public class NativeMethodBenchmark { 22 public void time_emptyJniStaticSynchronizedMethod0(int reps) throws Exception { 23 for (int i = 0; i < reps; ++i) { 24 NativeTestTarget.emptyJniStaticSynchronizedMethod0(); 25 } 26 } 27 28 public void time_emptyJniSynchronizedMethod0(int reps) throws Exception { 29 NativeTestTarget n = new NativeTestTarget(); 30 for (int i = 0; i < reps; ++i) { 31 n.emptyJniSynchronizedMethod0(); 32 } 33 } 34 35 public void time_emptyJniStaticMethod0(int reps) throws Exception { 36 for (int i = 0; i < reps; ++i) { 37 NativeTestTarget.emptyJniStaticMethod0(); 38 } 39 } 40 41 public void time_emptyJniMethod0(int reps) throws Exception { 42 NativeTestTarget n = new NativeTestTarget(); 43 for (int i = 0; i < reps; ++i) { 44 n.emptyJniMethod0(); 45 } 46 } 47 48 public void time_emptyJniStaticMethod6(int reps) throws Exception { 49 int a = -1; 50 int b = 0; 51 for (int i = 0; i < reps; ++i) { 52 NativeTestTarget.emptyJniStaticMethod6(a, b, 1, 2, 3, i); 53 } 54 } 55 56 public void time_emptyJniMethod6(int reps) throws Exception { 57 int a = -1; 58 int b = 0; 59 NativeTestTarget n = new NativeTestTarget(); 60 for (int i = 0; i < reps; ++i) { 61 n.emptyJniMethod6(a, b, 1, 2, 3, i); 62 } 63 } 64 65 public void time_emptyJniStaticMethod6L(int reps) throws Exception { 66 for (int i = 0; i < reps; ++i) { 67 NativeTestTarget.emptyJniStaticMethod6L(null, null, null, null, null, null); 68 } 69 } 70 71 public void time_emptyJniMethod6L(int reps) throws Exception { 72 NativeTestTarget n = new NativeTestTarget(); 73 for (int i = 0; i < reps; ++i) { 74 n.emptyJniMethod6L(null, null, null, null, null, null); 75 } 76 } 77 78} 79