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 17 package benchmarks.regression; 18 19 import org.apache.harmony.dalvik.NativeTestTarget; 20 21 public 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 36 public void time_emptyJniMethod0(int reps) throws Exception { 37 NativeTestTarget n = new NativeTestTarget(); 38 for (int i = 0; i < reps; ++i) { 39 n.emptyJniMethod0(); 40 } 41 } 42 43 public void time_emptyJniMethod6(int reps) throws Exception { 44 int a = -1; 45 int b = 0; 46 NativeTestTarget n = new NativeTestTarget(); 47 for (int i = 0; i < reps; ++i) { 48 n.emptyJniMethod6(a, b, 1, 2, 3, i); 49 } 50 } 51 52 public void time_emptyJniMethod6L(int reps) throws Exception { 53 NativeTestTarget n = new NativeTestTarget(); 54 for (int i = 0; i < reps; ++i) { 55 n.emptyJniMethod6L(null, null, null, null, null, null); 56 } 57 } 58 59 public void time_emptyJniStaticMethod6L(int reps) throws Exception { 60 for (int i = 0; i < reps; ++i) { 61 NativeTestTarget.emptyJniStaticMethod6L(null, null, null, null, null, null); 62 } 63 } 64 public void time_emptyJniStaticMethod0(int reps) throws Exception { 65 for (int i = 0; i < reps; ++i) { 66 NativeTestTarget.emptyJniStaticMethod0(); 67 } 68 } 69 70 public void time_emptyJniStaticMethod6(int reps) throws Exception { 71 int a = -1; 72 int b = 0; 73 for (int i = 0; i < reps; ++i) { 74 NativeTestTarget.emptyJniStaticMethod6(a, b, 1, 2, 3, i); 75 } 76 } 77 78 public void time_emptyJniMethod0_Fast(int reps) throws Exception { 79 NativeTestTarget n = new NativeTestTarget(); 80 for (int i = 0; i < reps; ++i) { 81 n.emptyJniMethod0_Fast(); 82 } 83 } 84 85 public void time_emptyJniMethod6_Fast(int reps) throws Exception { 86 int a = -1; 87 int b = 0; 88 NativeTestTarget n = new NativeTestTarget(); 89 for (int i = 0; i < reps; ++i) { 90 n.emptyJniMethod6_Fast(a, b, 1, 2, 3, i); 91 } 92 } 93 94 public void time_emptyJniMethod6L_Fast(int reps) throws Exception { 95 NativeTestTarget n = new NativeTestTarget(); 96 for (int i = 0; i < reps; ++i) { 97 n.emptyJniMethod6L_Fast(null, null, null, null, null, null); 98 } 99 } 100 101 public void time_emptyJniStaticMethod6L_Fast(int reps) throws Exception { 102 for (int i = 0; i < reps; ++i) { 103 NativeTestTarget.emptyJniStaticMethod6L_Fast(null, null, null, null, null, null); 104 } 105 } 106 public void time_emptyJniStaticMethod0_Fast(int reps) throws Exception { 107 for (int i = 0; i < reps; ++i) { 108 NativeTestTarget.emptyJniStaticMethod0_Fast(); 109 } 110 } 111 112 public void time_emptyJniStaticMethod6_Fast(int reps) throws Exception { 113 int a = -1; 114 int b = 0; 115 for (int i = 0; i < reps; ++i) { 116 NativeTestTarget.emptyJniStaticMethod6_Fast(a, b, 1, 2, 3, i); 117 } 118 } 119 120 public void time_emptyJniStaticMethod0_Critical(int reps) throws Exception { 121 for (int i = 0; i < reps; ++i) { 122 NativeTestTarget.emptyJniStaticMethod0_Critical(); 123 } 124 } 125 126 public void time_emptyJniStaticMethod6_Critical(int reps) throws Exception { 127 int a = -1; 128 int b = 0; 129 for (int i = 0; i < reps; ++i) { 130 NativeTestTarget.emptyJniStaticMethod6_Critical(a, b, 1, 2, 3, i); 131 } 132 } 133 } 134