diff options
author | Alexandre Rames <alexandre.rames@linaro.org> | 2016-07-28 16:01:46 +0100 |
---|---|---|
committer | Alexandre Rames <alexandre.rames@linaro.org> | 2016-08-03 09:41:27 +0100 |
commit | 7940a49aceccb45be1d1fab4c4be2e59bd1d9acf (patch) | |
tree | 140b6885f895cee29b8b0b2d3e81c48b46d46268 | |
parent | d615235841275895b5b58191c7b79245fb375603 (diff) | |
download | art-testing-7940a49aceccb45be1d1fab4c4be2e59bd1d9acf.tar.gz |
Remove deprecated benchmarks.
Change-Id: I5b562fcdd843d264dc42098a516b98efa33a5c12
-rw-r--r-- | benchmarks/deprecated/GCTest.java | 68 | ||||
-rw-r--r-- | benchmarks/deprecated/InstanceTest.java | 103 | ||||
-rw-r--r-- | benchmarks/deprecated/JoinTest.java | 101 | ||||
-rw-r--r-- | benchmarks/deprecated/LockTest.java | 110 | ||||
-rw-r--r-- | benchmarks/deprecated/MultiplyAdd.java | 159 | ||||
-rw-r--r-- | benchmarks/deprecated/ObjFactorial.java | 91 | ||||
-rw-r--r-- | benchmarks/deprecated/StringOps.java | 81 | ||||
-rw-r--r-- | benchmarks/deprecated/Switch.java | 146 | ||||
-rw-r--r-- | benchmarks/deprecated/SyncFib.java | 69 | ||||
-rw-r--r-- | benchmarks/deprecated/SyncNorec.java | 62 | ||||
-rw-r--r-- | benchmarks/deprecated/Synchro.java | 70 | ||||
-rw-r--r-- | benchmarks/deprecated/VolatileTest.java | 71 | ||||
-rwxr-xr-x | tools/benchmarks/run.py | 12 |
13 files changed, 2 insertions, 1141 deletions
diff --git a/benchmarks/deprecated/GCTest.java b/benchmarks/deprecated/GCTest.java deleted file mode 100644 index edc26bb..0000000 --- a/benchmarks/deprecated/GCTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -import java.util.Random; - -public class GCTest { - - public static final int FACTOR = 10; - public static final int ITERATIONS = 5; - public static final int LIVE = FACTOR * 10; - public static final int BORN = LIVE * FACTOR * 100; - public static final int SIZE = FACTOR; - - public static void main(String[] args) { - long before = System.currentTimeMillis(); - timeSmash(BORN); - long after = System.currentTimeMillis(); - System.out.println("GCTest: " + (after - before)); - } - - public GCTest() { - } - - public static void timeSmash(int iters) { - GCTest[] list = new GCTest[LIVE]; - Random rnd = new Random(123456789); - for (int i = 0; i < iters; i++) { - smash(list, rnd); - } - } - - public static void smash(GCTest[] list, Random rnd) { - for (int i = 0; i < ITERATIONS; i++) { - int index = rnd.nextInt(list.length); - int size = rnd.nextInt(SIZE); - list[index] = new GCTest(facebook, size); - } - } - - public static Object facebook = new Object(); - - public GCTest(Object ptr, int varSize) { - pointer = ptr; - variable = new int[varSize]; - } - - private Object pointer = null; - private int[] variable = null; -} - diff --git a/benchmarks/deprecated/InstanceTest.java b/benchmarks/deprecated/InstanceTest.java deleted file mode 100644 index fad50d8..0000000 --- a/benchmarks/deprecated/InstanceTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; -import java.util.ArrayList; -import java.util.Random; - -import org.linaro.bench.IterationsAnnotation; - -public class InstanceTest { - - public static final int ITERATIONS = 1000; - public static final int INSTANCES = 1000; - - public static void main(String[] args) { - long before = System.currentTimeMillis(); - timeCheckInstances(ITERATIONS); - long after = System.currentTimeMillis(); - System.out.println("instanceof: " + (after - before)); - } - - public static void initializeInstances(ArrayList<Object> list, Random rnd) { - Object o = null; - for (int i = 0; i < INSTANCES; i++) { - switch (rnd.nextInt(4)) { - case 0: - o = new A(); - break; - case 1: - o = new B(); - break; - case 2: - o = new C(); - break; - case 3: - o = new D(); - break; - default: o = null; - } - list.add(o); - } - } - - @IterationsAnnotation(noWarmup = true, iterations = 1000) - public static void timeCheckInstances(int iters) { - ArrayList<Object> list = new ArrayList<Object>(); - Random rnd = new Random(123456789); - initializeInstances(list, rnd); - for (int i = 0; i < iters; i++) { - checkInstances(list); - } - } - - public static void checkInstances(ArrayList<Object> list) { - answerA = 0; - answerB = 0; - answerC = 0; - answerD = 0; - error = 0; - - for (Object o : list) { - if (o instanceof A) answerA++; - if (o instanceof B) answerB++; - if (o instanceof C) answerC++; - if (o instanceof D) answerD++; - if (o == null) error++; - } - } - - private static int answerA = 0; - private static int answerB = 0; - private static int answerC = 0; - private static int answerD = 0; - private static int error = 0; -} - -class A { -} - -class B extends A { -} - -class C extends B { -} - -class D { -} diff --git a/benchmarks/deprecated/JoinTest.java b/benchmarks/deprecated/JoinTest.java deleted file mode 100644 index 0483d54..0000000 --- a/benchmarks/deprecated/JoinTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.InterruptedException; -import java.lang.System; -import java.lang.Thread; -import java.util.ArrayList; -import java.util.Random; - -import org.linaro.bench.IterationsAnnotation; - -public class JoinTest extends Thread { - - public static final int THREAD_NUMBER = 50; - public static final int MAX_PAUSE = 1000; - - @IterationsAnnotation(noWarmup = true, iterations = 1) - public static void timeJoinOfFiftyThreads(int iters) { - for (int i = 0; i < iters; i++) { - Random rnd = new Random(123456789); - ArrayList<Thread> list = new ArrayList<Thread>(); - for (int x = 0; x < THREAD_NUMBER; x++) { - list.add(new JoinTest(rnd)); - } - for (Thread t : list) { - t.start(); - } - - for (Thread t : list) { - try { - t.join(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - System.out.println("While joining"); - } - } - } - } - - public static void main(String[] args) { - - long before = System.currentTimeMillis(); - timeJoinOfFiftyThreads(1); - long after = System.currentTimeMillis(); - System.out.println("join of " + THREAD_NUMBER + ": " + (after - before)); - } - - public JoinTest() { - } - - public JoinTest(Random rnd) { - dummy = 0; - firstPause = (long) rnd.nextInt(MAX_PAUSE); - secondPause = (long) rnd.nextInt(MAX_PAUSE); - } - - public void run() { - try { - sleep(firstPause); - } catch (InterruptedException ie) { - ie.printStackTrace(); - System.out.println("While first pause"); - } - - synchronized (lock) { - dummy++; - } - - try { - sleep(secondPause); - } catch (InterruptedException ie) { - ie.printStackTrace(); - System.out.println("While second pause"); - } - } - - public int dummy() { - return dummy; - } - - private int dummy; - private long firstPause; - private long secondPause; - private static Object lock = new Object(); -} diff --git a/benchmarks/deprecated/LockTest.java b/benchmarks/deprecated/LockTest.java deleted file mode 100644 index ac70d26..0000000 --- a/benchmarks/deprecated/LockTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -import org.linaro.bench.IterationsAnnotation; - -public class LockTest { - - public static final int ITERATIONS = 200000; - - public static void main(String[] args) { - long before = System.currentTimeMillis(); - timeStaticLockWithDepth1(ITERATIONS); - long after = System.currentTimeMillis(); - System.out.println("static(1) : " + (after - before)); - - before = System.currentTimeMillis(); - timeStaticLockWithDepth2(ITERATIONS); - after = System.currentTimeMillis(); - System.out.println("static(2) : " + (after - before)); - - before = System.currentTimeMillis(); - timeStaticLockWithDepth20(ITERATIONS); - after = System.currentTimeMillis(); - System.out.println("static(20) : " + (after - before)); - - LockTest l = new LockTest(); - before = System.currentTimeMillis(); - l.timeDynamicLockWithDepth1(ITERATIONS); - after = System.currentTimeMillis(); - System.out.println("dynamic(1) : " + (after - before)); - - before = System.currentTimeMillis(); - l.timeDynamicLockWithDepth2(ITERATIONS); - after = System.currentTimeMillis(); - System.out.println("dynamic(2) : " + (after - before)); - - before = System.currentTimeMillis(); - l.timeDynamicLockWithDepth20(ITERATIONS); - after = System.currentTimeMillis(); - System.out.println("dynamic(20): " + (after - before)); - } - - public static synchronized void timeStaticLockWithDepth1(int iters) { - for (int i = 0; i < iters; i++) { - staticLockWithDepth(1); - } - } - - @IterationsAnnotation(noWarmup = true) - public static synchronized void timeStaticLockWithDepth2(int iters) { - for (int i = 0; i < iters; i++) { - staticLockWithDepth(2); - } - } - - @IterationsAnnotation(noWarmup = true) - public static synchronized void timeStaticLockWithDepth20(int iters) { - for (int i = 0; i < iters; i++) { - staticLockWithDepth(20); - } - } - - public synchronized void timeDynamicLockWithDepth1(int iters) { - for (int i = 0; i < iters; i++) { - dynamicLockWithDepth(1); - } - } - - public synchronized void timeDynamicLockWithDepth2(int iters) { - for (int i = 0; i < iters; i++) { - dynamicLockWithDepth(2); - } - } - - @IterationsAnnotation(noWarmup = true) - public synchronized void timeDynamicLockWithDepth20(int iters) { - for (int i = 0; i < iters; i++) { - dynamicLockWithDepth(20); - } - } - - public static synchronized void staticLockWithDepth(int depth) { - if (depth == 1) return; - staticLockWithDepth(depth - 1); - } - - public synchronized void dynamicLockWithDepth(int depth) { - if (depth == 1) return; - dynamicLockWithDepth(depth - 1); - } -} - diff --git a/benchmarks/deprecated/MultiplyAdd.java b/benchmarks/deprecated/MultiplyAdd.java deleted file mode 100644 index cb62799..0000000 --- a/benchmarks/deprecated/MultiplyAdd.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.reflect.Method; - -public class MultiplyAdd { - public static final int ITERATIONS = 100000000; - public static final int VALUE = 500; - - public static void main(String[] args) { - long start = 0; - long end = 0; - MultiplyAdd test = new MultiplyAdd(); - - Method[] methods = test.getClass().getDeclaredMethods(); - // sort methods by name - for (int i = 0; i < methods.length; i++) { - for (int j = 0; j < methods.length - i - 1; j++) { - if (methods[j].getName().compareTo(methods[j + 1].getName()) > 0) { - Method tmp = methods[j]; - methods[j] = methods[j + 1]; - methods[j + 1] = tmp; - } - } - } - - for (int i = 0; i < methods.length; i++) { - Method m = methods[i]; - if (m.getName().startsWith("time")) { - start = System.currentTimeMillis(); - end = start - 1; - try { - Object o = m.invoke(test, ITERATIONS); - end = System.currentTimeMillis(); - } catch (Exception e) { - System.err.println("Invoke method: " + m.toGenericString()); - } - System.out.println(m.getDeclaringClass().getName() + "." - + m.getName().substring(4) + ": " + (end - start)); - } - } - } - - public int timeSimpleMaddw(int iters) { - int result = 0; - for (int i = 0; i < iters; i++) { - result += i * i; - } - return result; - } - - public long timeSimpleMaddx(int iters) { - long result = 0; - for (int i = 0; i < iters; i++) { - long tmp = i; - result += tmp * tmp; - } - return result; - } - - public int timeSimpleMsubw(int iters) { - int result = 0; - for (int i = 0; i < iters; i++) { - result -= i * i; - } - return result; - } - - public long timeSimpleMsubx(int iters) { - long result = 0; - for (int i = 0; i < iters; i++) { - long tmp = i; - result += tmp * tmp; - } - return result; - } - - public int timeMaddwBack2back(int iters) { - int result = 0; - int tmp1 = 0; - int tmp2 = 0; - for (int i = 0; i < iters; i++) { - tmp1 += i * i; - tmp2 += tmp1 * tmp1; - result += tmp2 * tmp2; - } - return result; - } - - public long timeMaddxBack2back(int iters) { - long result = 0; - long tmp1 = 0; - long tmp2 = 0; - for (int i = 0; i < iters; i++) { - long a = i; - tmp1 += a * a; - tmp2 += tmp1 * tmp1; - result += tmp2 * tmp2; - } - return result; - } - - public int timeMaddwInterleave(int iters) { - int result = 0; - int tmp1 = 0; - int tmp2 = 0; - for (int i = 0; i < iters; i++) { - tmp1 += i * i; - tmp2 = tmp1 + tmp1; - result += tmp2 * tmp2; - } - return result; - } - - public long timeMaddxInterleave(int iters) { - long result = 0; - long tmp1 = 0; - long tmp2 = 0; - for (int i = 0; i < iters; i++) { - long a = i; - tmp1 += a * a; - tmp2 += tmp1 + tmp1; - result += tmp2 * tmp2; - } - return result; - } - - public long timeMixed(int iters) { - long result = 0; - long tmp = 0; - long lt = 12; - int a = 0; - for (int i = 0; i < iters; i++) { - a = (i - 2) + i * i; - a = 1 + a * a; - tmp = a; - result -= tmp * tmp; - tmp++; - result += tmp * tmp + (tmp >> 2) * tmp + (tmp >> 2) * lt; - } - return result; - } -} diff --git a/benchmarks/deprecated/ObjFactorial.java b/benchmarks/deprecated/ObjFactorial.java deleted file mode 100644 index 10dfd08..0000000 --- a/benchmarks/deprecated/ObjFactorial.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; -import java.math.BigInteger; - -class MyLong { - private long value; - - public MyLong(long value) { - this.value = value; - } - - public long get() { - return value; - } - - public void set(long newValue) { - value = newValue; - } - - public int compareTo(MyLong other) { - if (value > other.value) { - return 1; - } - if (value == other.value) { - return 0; - } - return -1; - } -} - -public class ObjFactorial { - - public static void timeBigFact(int iters) { - BigInteger bigOne = new BigInteger("1"); - BigInteger bigInput = new BigInteger("20"); - BigInteger bigResult = bigOne; - for (int x = 0; x < iters; x++) { - bigResult = bigOne; - for (BigInteger i = bigOne; i.compareTo(bigInput) == -1; i = i.add(bigOne)) { - bigResult = bigResult.multiply(i); - } - } - } - - public static void timeMyFact(int iters) { - MyLong myInput = new MyLong(20); - MyLong myResult = new MyLong(1); - for (int x = 0; x < iters; x++) { - myResult = new MyLong(1); - for (MyLong i = new MyLong(1); i.compareTo(myInput) == -1; i.set(i.get() + 1)) { - myResult.set(myResult.get() * i.get()); - } - } - } - - public static void main(String[] args) { - - final int ITERATIONS_BIG = 1000; - final int ITERATIONS_MY = 100000; - - long before = System.currentTimeMillis(); - timeBigFact(ITERATIONS_BIG); - long after = System.currentTimeMillis(); - System.out.println("bigFact: " + (after - before)); - - before = System.currentTimeMillis(); - timeMyFact(ITERATIONS_MY); - after = System.currentTimeMillis(); - - System.out.println("myFact: " + (after - before)); - - } -} diff --git a/benchmarks/deprecated/StringOps.java b/benchmarks/deprecated/StringOps.java deleted file mode 100644 index b1c2f1f..0000000 --- a/benchmarks/deprecated/StringOps.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -// This benchmark performs various string operations. -public class StringOps { - public static final int INNER_LOOP_COUNT = 512; - public String string1; - public String string2; - public String string3; - public String string4; - public String string5; - - public StringOps() { - this.string1 = "first "; - this.string2 = "second "; - this.string3 = "third "; - this.string4 = "fourth "; - this.string5 = "fifth "; - } - - public int timeAppend(int iterations) { - StringBuffer str = new StringBuffer(" "); - for (int i = 0; i < iterations; ++i) { - for (int j = 0; j < this.INNER_LOOP_COUNT; ++j) { - str.append(this.string1); - str.append(this.string2); - str.append(this.string3); - str.append(this.string4); - str.append(this.string5); - } - } - return str.length(); - } - - public int timeAppendAndSearch(int iterations) { - StringBuffer str = new StringBuffer(" "); - int index = 0; - for (int i = 0; i < iterations; ++i) { - for (int j = 0; j < this.INNER_LOOP_COUNT; ++j) { - str.append(this.string1); - } - str.append(this.string2); - for (int j = 0; j < this.INNER_LOOP_COUNT; ++j) { - index = str.toString().indexOf(this.string2, j * this.string1.length()); - } - } - return index; - } - - public static void main(String[] args) { - StringOps obj = new StringOps(); - long before = System.currentTimeMillis(); - obj.timeAppend(1); - long after = System.currentTimeMillis(); - System.out.println("String append : " + (after - before)); - - before = System.currentTimeMillis(); - obj.timeAppendAndSearch(1); - after = System.currentTimeMillis(); - System.out.println("String append and search: " + (after - before)); - } -} - diff --git a/benchmarks/deprecated/Switch.java b/benchmarks/deprecated/Switch.java deleted file mode 100644 index 2df6ba8..0000000 --- a/benchmarks/deprecated/Switch.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -public class Switch { - - public static final int ITERATIONS_DENSE = 20000000; - public static final int ITERATIONS_SPARSE = 5000000; - public static final int ITERATIONS_IFELSE = 5000000; - - public static void main(String[] args) { - long before = System.currentTimeMillis(); - timeDense(ITERATIONS_DENSE); - long after = System.currentTimeMillis(); - System.out.println("packed switch: " + (after - before)); - - before = System.currentTimeMillis(); - timeSparse(ITERATIONS_SPARSE); - after = System.currentTimeMillis(); - System.out.println("sparse switch: " + (after - before)); - - before = System.currentTimeMillis(); - timeIfelse(ITERATIONS_IFELSE); - after = System.currentTimeMillis(); - System.out.println("if-else: " + (after - before)); - } - - public static int timeDense(int iters) { - int sum = 0; - - for (int i = 0; i < iters; i++) { - switch (i & 0x1f) { - // CHECKSTYLE.OFF: OneStatementPerLine - case 0: sum++; break; - case 1: sum--; break; - case 2: sum++; break; - case 3: sum--; break; - case 4: sum++; break; - case 5: sum--; break; - case 6: sum++; break; - case 7: sum--; break; - case 8: sum++; break; - case 9: sum--; break; - case 10: sum++; break; - case 11: sum--; break; - case 12: sum++; break; - case 13: sum--; break; - case 14: sum++; break; - case 15: sum--; break; - case 16: sum++; break; - case 17: sum--; break; - case 18: sum++; break; - case 19: sum--; break; - default: sum += 2; - // CHECKSTYLE.ON: OneStatementPerLine - } - } - - return sum; - } - - public static int timeSparse(int iters) { - int sum = 0; - - for (int i = 0; i < iters; i++) { - switch (i & 0x7ff) { - // CHECKSTYLE.OFF: OneStatementPerLine - case 0: sum++; break; - case 11: sum--; break; - case 22: sum++; break; - case 33: sum--; break; - case 44: sum++; break; - case 55: sum--; break; - case 66: sum++; break; - case 77: sum--; break; - case 88: sum++; break; - case 99: sum--; break; - case 1010: sum++; break; - case 1111: sum--; break; - case 1212: sum++; break; - case 1313: sum--; break; - case 1414: sum++; break; - case 1515: sum--; break; - case 1616: sum++; break; - case 1717: sum--; break; - case 1818: sum++; break; - case 1919: sum--; break; - default: sum += 2; - // CHECKSTYLE.ON: OneStatementPerLine - } - } - - return sum; - } - - public static int timeIfelse(int iters) { - int sum = 0; - - for (int i = 0; i < iters; i++) { - // CHECKSTYLE.OFF: NeedBraces - int val = i & 0x7ff; - if (val == 0) sum++; - else if (val == 11) sum--; - else if (val == 22) sum++; - else if (val == 33) sum--; - else if (val == 44) sum++; - else if (val == 55) sum--; - else if (val == 66) sum++; - else if (val == 77) sum--; - else if (val == 88) sum++; - else if (val == 99) sum--; - else if (val == 1010) sum++; - else if (val == 1111) sum--; - else if (val == 1212) sum++; - else if (val == 1313) sum--; - else if (val == 1414) sum++; - else if (val == 1515) sum--; - else if (val == 1616) sum++; - else if (val == 1717) sum--; - else if (val == 1818) sum++; - else if (val == 1919) sum--; - else sum += 2; - // CHECKSTYLE.ON: NeedBraces - } - - return sum; - } -} - diff --git a/benchmarks/deprecated/SyncFib.java b/benchmarks/deprecated/SyncFib.java deleted file mode 100644 index dee7327..0000000 --- a/benchmarks/deprecated/SyncFib.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -import org.linaro.bench.IterationsAnnotation; - -public class SyncFib { - - public static final int ITERATIONS_SFIB = 300; - public static final int ITERATIONS_AFIB = 500; - - public static void main(String[] args) { - long sum = 0; - long before = System.currentTimeMillis(); - timeSfib(ITERATIONS_SFIB); - long after = System.currentTimeMillis(); - System.out.println("sfib: " + (after - before)); - sum = 0; - before = System.currentTimeMillis(); - timeAfib(ITERATIONS_AFIB); - after = System.currentTimeMillis(); - System.out.println("afib: " + (after - before)); - } - - @IterationsAnnotation(noWarmup = true, iterations = 600) - public static long timeSfib(int iters) { - long sum = 0; - for (int i = 0; i < iters; i++) { - sum += sfib(20); - } - return sum; - } - - @IterationsAnnotation(noWarmup = true, iterations = 1000) - public static long timeAfib(int iters) { - long sum = 0; - for (int i = 0; i < iters; i++) { - sum += afib(20); - } - return sum; - } - - static synchronized int sfib(int n) { - if (n < 2) return 1; - return sfib(n - 1) + sfib(n - 2); - } - - static int afib(int n) { - if (n < 2) return 1; - return afib(n - 1) + afib(n - 2); - } -} diff --git a/benchmarks/deprecated/SyncNorec.java b/benchmarks/deprecated/SyncNorec.java deleted file mode 100644 index a316619..0000000 --- a/benchmarks/deprecated/SyncNorec.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -public class SyncNorec { - - public static final int ITERATIONS = 1000000; - - public static void main(String[] args) { - SyncNorec dummy = new SyncNorec(); - long before = System.currentTimeMillis(); - dummy.timeInc(ITERATIONS); - long after = System.currentTimeMillis(); - System.out.println("sync no rec: " + (after - before)); - } - - private Object lock1; - private Object lock2; - private Object lock3; - private int value; - - public SyncNorec() { - lock1 = new Object(); - lock2 = new Object(); - lock3 = new Object(); - value = 0; - } - - public void timeInc(int iters) { - for (int i = 0; i < iters; ++i) { - synchronized (lock1) { - synchronized (lock2) { - synchronized (lock3) { - value++; - } - } - } - } - } - - public int value() { - return value; - } -} - diff --git a/benchmarks/deprecated/Synchro.java b/benchmarks/deprecated/Synchro.java deleted file mode 100644 index e9336c7..0000000 --- a/benchmarks/deprecated/Synchro.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -public class Synchro { - - public static final int ITERATIONS = 100000; - - public static void main(String[] args) { - Synchro dummy = new Synchro(); - long before = System.currentTimeMillis(); - dummy.timeInc(ITERATIONS); - long after = System.currentTimeMillis(); - System.out.println("Synchro: " + (after - before)); - } - - private Object lock1; - private Object lock2; - private Object lock3; - private int value; - - public Synchro() { - lock1 = new Object(); - lock2 = new Object(); - lock3 = new Object(); - value = 0; - } - - public void timeInc(int iters) { - for (int i = 0; i < iters; i++) { - inc(); - } - } - - public void inc() { - synchronized (lock1) { - synchronized (lock2) { - synchronized (lock1) { - synchronized (lock2) { - synchronized (lock3) { - value++; - } - } - } - } - } - } - - public int value() { - return value; - } -} - diff --git a/benchmarks/deprecated/VolatileTest.java b/benchmarks/deprecated/VolatileTest.java deleted file mode 100644 index 42717e5..0000000 --- a/benchmarks/deprecated/VolatileTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package benchmarks.deprecated; - -import java.lang.System; - -public class VolatileTest { - - public static final int ITERATIONS = 1000000; - - public static void main(String[] args) { - VolatileTest test = new VolatileTest(); - - long before = System.currentTimeMillis(); - test.timeLoadStores(ITERATIONS); - long after = System.currentTimeMillis(); - System.out.println("load-store volatile: " + (after - before)); - } - - public void timeLoadStores(int iters) { - for (int i = 0; i < iters; i++) { - loadStores(); - } - } - - // from the jsr 133 cook book. - public void loadStores() { - int i; - int j; - - i = a; - j = b; - i = v; - // LoadLoad - j = u; - // LoadStore - a = i; - b = j; - // StoreStore - v = i; - // StoreStore - u = j; - // StoreLoad - i = u; - // LoadLoad - // LoadStore - j = b; - a = i; - } - - private int a; - private int b; - private volatile int u; - private volatile int v; -} - diff --git a/tools/benchmarks/run.py b/tools/benchmarks/run.py index 93e1edf..6d0cc6b 100755 --- a/tools/benchmarks/run.py +++ b/tools/benchmarks/run.py @@ -56,9 +56,7 @@ def BuildOptions(): filters match, filtering will be attempted with all the patterns prefixed and suffixed with `*`.''') parser.add_argument('-F', '--filter-out', action = 'append', - help='''Filter out the benchmarks matching this pattern. - Defaults to \'benchmarks/deprecated/*\' if no other - filter is specified.''') + help='Filter out the benchmarks matching this pattern.') args = parser.parse_args() @@ -248,13 +246,7 @@ def GetBenchmarkResults(args): benchmarks = ListAllBenchmarks() - # The deprecated benchmarks should not be implicitly filtered out when - # filters are explicitly specified on the command line. - if args.filter is not None or args.filter_out is not None: - filter_out = args.filter_out - else: - filter_out = ['benchmarks/deprecated/*'] - benchmarks = utils.FilterList(benchmarks, args.filter, filter_out) + benchmarks = utils.FilterList(benchmarks, args.filter, args.filter_out) rc = RunBenchs(remote_apk, benchmarks, |