diff options
author | 2015-09-12 16:55:26 -0700 | |
---|---|---|
committer | 2015-09-14 13:45:53 -0700 | |
commit | 563e9846711aa1830bc7a34499204091032349fb (patch) | |
tree | cd7974c696430f703d65c2e82ba347df900a4aaf | |
parent | b09f33381174843214de40533366e162a0c6d768 (diff) |
Convert ART benchmarks into caliper benchmarks
Move the ART benchmarks into the benchmarks directory and make them
caliper friendly.
To run you need to build libartbenchmark.so and sync it then use
vogar --benchmark.
Bug: 24055147
Change-Id: Idc9caf8dc8022190d737840ba0eb9e356f9872cb
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | benchmark/Android.mk | 78 | ||||
-rw-r--r-- | benchmark/jni-perf/info.txt (renamed from test/999-jni-perf/info.txt) | 0 | ||||
-rw-r--r-- | benchmark/jni-perf/perf_jni.cc (renamed from test/999-jni-perf/perf-jni.cc) | 12 | ||||
-rw-r--r-- | benchmark/jni-perf/src/JniPerfBenchmark.java | 54 | ||||
-rw-r--r-- | benchmark/scoped-primitive-array/info.txt (renamed from test/998-scoped-primitive-array/info.txt) | 0 | ||||
-rw-r--r-- | benchmark/scoped-primitive-array/scoped_primitive_array.cc | 58 | ||||
-rw-r--r-- | benchmark/scoped-primitive-array/src/ScopedPrimitiveArrayBenchmark.java | 93 | ||||
-rwxr-xr-x | test/998-scoped-primitive-array/check | 22 | ||||
-rw-r--r-- | test/998-scoped-primitive-array/expected.txt | 1 | ||||
-rw-r--r-- | test/998-scoped-primitive-array/scoped_primitive_array.cc | 66 | ||||
-rw-r--r-- | test/998-scoped-primitive-array/src/Main.java | 85 | ||||
-rwxr-xr-x | test/999-jni-perf/check | 18 | ||||
-rw-r--r-- | test/999-jni-perf/expected.txt | 1 | ||||
-rw-r--r-- | test/999-jni-perf/src/Main.java | 69 | ||||
-rw-r--r-- | test/Android.libarttest.mk | 4 |
16 files changed, 289 insertions, 273 deletions
diff --git a/Android.mk b/Android.mk index 8859d3a285..06f3026f09 100644 --- a/Android.mk +++ b/Android.mk @@ -119,6 +119,7 @@ TEST_ART_TARGET_SYNC_DEPS := include $(art_path)/build/Android.common_test.mk include $(art_path)/build/Android.gtest.mk include $(art_path)/test/Android.run-test.mk +include $(art_path)/benchmark/Android.mk # Sync test files to the target, depends upon all things that must be pushed to the target. .PHONY: test-art-target-sync diff --git a/benchmark/Android.mk b/benchmark/Android.mk new file mode 100644 index 0000000000..09aca98337 --- /dev/null +++ b/benchmark/Android.mk @@ -0,0 +1,78 @@ +# +# Copyright (C) 2015 The Android Open Source Project +# +# 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. +# + +LOCAL_PATH := $(call my-dir) + +include art/build/Android.common_build.mk + +LIBARTBENCHMARK_COMMON_SRC_FILES := \ + jni-perf/perf_jni.cc \ + scoped-primitive-array/scoped_primitive_array.cc + +# $(1): target or host +define build-libartbenchmark + ifneq ($(1),target) + ifneq ($(1),host) + $$(error expected target or host for argument 1, received $(1)) + endif + endif + + art_target_or_host := $(1) + + include $(CLEAR_VARS) + LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) + LOCAL_MODULE := libartbenchmark + ifeq ($$(art_target_or_host),target) + LOCAL_MODULE_TAGS := tests + endif + LOCAL_SRC_FILES := $(LIBARTBENCHMARK_COMMON_SRC_FILES) + LOCAL_SHARED_LIBRARIES += libart libbacktrace libnativehelper + LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime + LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk + LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk + ifeq ($$(art_target_or_host),target) + $(call set-target-local-clang-vars) + $(call set-target-local-cflags-vars,debug) + LOCAL_SHARED_LIBRARIES += libdl + LOCAL_MULTILIB := both + # LOCAL_MODULE_PATH_32 := $(ART_TARGET_OUT)/$(ART_TARGET_ARCH_32) + # LOCAL_MODULE_PATH_64 := $(ART_TARGET_OUT)/$(ART_TARGET_ARCH_64) + LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH) + include $(BUILD_SHARED_LIBRARY) + else # host + LOCAL_CLANG := $(ART_HOST_CLANG) + LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS) + LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS) + LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -ldl -lpthread + LOCAL_IS_HOST_MODULE := true + LOCAL_MULTILIB := both + include $(BUILD_HOST_SHARED_LIBRARY) + endif + + # Clear locally used variables. + art_target_or_host := +endef + +ifeq ($(ART_BUILD_TARGET),true) + $(eval $(call build-libartbenchmark,target)) +endif +ifeq ($(ART_BUILD_HOST),true) + $(eval $(call build-libartbenchmark,host)) +endif + +# Clear locally used variables. +LOCAL_PATH := +LIBARTBENCHMARK_COMMON_SRC_FILES := diff --git a/test/999-jni-perf/info.txt b/benchmark/jni-perf/info.txt index 010b57be2b..010b57be2b 100644 --- a/test/999-jni-perf/info.txt +++ b/benchmark/jni-perf/info.txt diff --git a/test/999-jni-perf/perf-jni.cc b/benchmark/jni-perf/perf_jni.cc index 51eeb83250..cd8d520f16 100644 --- a/test/999-jni-perf/perf-jni.cc +++ b/benchmark/jni-perf/perf_jni.cc @@ -24,18 +24,14 @@ namespace art { namespace { -extern "C" JNIEXPORT jint JNICALL Java_Main_perfJniEmptyCall(JNIEnv*, jobject) { - return 0; -} +extern "C" JNIEXPORT void JNICALL Java_JniPerfBenchmark_perfJniEmptyCall(JNIEnv*, jobject) {} -extern "C" JNIEXPORT jint JNICALL Java_Main_perfSOACall(JNIEnv*, jobject) { - ScopedObjectAccess soa(Thread::Current()); - return 0; +extern "C" JNIEXPORT void JNICALL Java_JniPerfBenchmark_perfSOACall(JNIEnv* env, jobject) { + ScopedObjectAccess soa(env); } -extern "C" JNIEXPORT jint JNICALL Java_Main_perfSOAUncheckedCall(JNIEnv*, jobject) { +extern "C" JNIEXPORT void JNICALL Java_JniPerfBenchmark_perfSOAUncheckedCall(JNIEnv*, jobject) { ScopedObjectAccessUnchecked soa(Thread::Current()); - return 0; } } // namespace diff --git a/benchmark/jni-perf/src/JniPerfBenchmark.java b/benchmark/jni-perf/src/JniPerfBenchmark.java new file mode 100644 index 0000000000..b1b21ce0ba --- /dev/null +++ b/benchmark/jni-perf/src/JniPerfBenchmark.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * 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. + */ + +import com.google.caliper.SimpleBenchmark; + +public class JniPerfBenchmark extends SimpleBenchmark { + private static final String MSG = "ABCDE"; + + native void perfJniEmptyCall(); + native void perfSOACall(); + native void perfSOAUncheckedCall(); + + public void timeFastJNI(int N) { + // TODO: This might be an intrinsic. + for (long i = 0; i < N; i++) { + char c = MSG.charAt(2); + } + } + + public void timeEmptyCall(int N) { + for (long i = 0; i < N; i++) { + perfJniEmptyCall(); + } + } + + public void timeSOACall(int N) { + for (long i = 0; i < N; i++) { + perfSOACall(); + } + } + + public void timeSOAUncheckedCall(int N) { + for (long i = 0; i < N; i++) { + perfSOAUncheckedCall(); + } + } + + { + System.loadLibrary("artbenchmark"); + } +} diff --git a/test/998-scoped-primitive-array/info.txt b/benchmark/scoped-primitive-array/info.txt index 93abb7ce8f..93abb7ce8f 100644 --- a/test/998-scoped-primitive-array/info.txt +++ b/benchmark/scoped-primitive-array/info.txt diff --git a/benchmark/scoped-primitive-array/scoped_primitive_array.cc b/benchmark/scoped-primitive-array/scoped_primitive_array.cc new file mode 100644 index 0000000000..1664157297 --- /dev/null +++ b/benchmark/scoped-primitive-array/scoped_primitive_array.cc @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * 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. + */ + +#include "jni.h" +#include "ScopedPrimitiveArray.h" + +extern "C" JNIEXPORT jlong JNICALL Java_ScopedPrimitiveArrayBenchmark_measureByteArray( + JNIEnv* env, jclass, int reps, jbyteArray arr) { + jlong ret = 0; + for (jint i = 0; i < reps; ++i) { + ScopedByteArrayRO sc(env, arr); + ret += sc[0] + sc[sc.size() - 1]; + } + return ret; +} + +extern "C" JNIEXPORT jlong JNICALL Java_ScopedPrimitiveArrayBenchmark_measureShortArray( + JNIEnv* env, jclass, int reps, jshortArray arr) { + jlong ret = 0; + for (jint i = 0; i < reps; ++i) { + ScopedShortArrayRO sc(env, arr); + ret += sc[0] + sc[sc.size() - 1]; + } + return ret; +} + +extern "C" JNIEXPORT jlong JNICALL Java_ScopedPrimitiveArrayBenchmark_measureIntArray( + JNIEnv* env, jclass, int reps, jintArray arr) { + jlong ret = 0; + for (jint i = 0; i < reps; ++i) { + ScopedIntArrayRO sc(env, arr); + ret += sc[0] + sc[sc.size() - 1]; + } + return ret; +} + +extern "C" JNIEXPORT jlong JNICALL Java_ScopedPrimitiveArrayBenchmark_measureLongArray( + JNIEnv* env, jclass, int reps, jlongArray arr) { + jlong ret = 0; + for (jint i = 0; i < reps; ++i) { + ScopedLongArrayRO sc(env, arr); + ret += sc[0] + sc[sc.size() - 1]; + } + return ret; +} diff --git a/benchmark/scoped-primitive-array/src/ScopedPrimitiveArrayBenchmark.java b/benchmark/scoped-primitive-array/src/ScopedPrimitiveArrayBenchmark.java new file mode 100644 index 0000000000..be276fe48c --- /dev/null +++ b/benchmark/scoped-primitive-array/src/ScopedPrimitiveArrayBenchmark.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * 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. + */ + +import com.google.caliper.SimpleBenchmark; + +public class ScopedPrimitiveArrayBenchmark extends SimpleBenchmark { + // Measure adds the first and last element of the array by using ScopedPrimitiveArray. + static native long measureByteArray(int reps, byte[] arr); + static native long measureShortArray(int reps, short[] arr); + static native long measureIntArray(int reps, int[] arr); + static native long measureLongArray(int reps, long[] arr); + + static final int smallLength = 16; + static final int mediumLength = 256; + static final int largeLength = 8096; + static byte[] smallBytes = new byte[smallLength]; + static byte[] mediumBytes = new byte[mediumLength]; + static byte[] largeBytes = new byte[largeLength]; + static short[] smallShorts = new short[smallLength]; + static short[] mediumShorts = new short[mediumLength]; + static short[] largeShorts = new short[largeLength]; + static int[] smallInts = new int[smallLength]; + static int[] mediumInts = new int[mediumLength]; + static int[] largeInts = new int[largeLength]; + static long[] smallLongs = new long[smallLength]; + static long[] mediumLongs = new long[mediumLength]; + static long[] largeLongs = new long[largeLength]; + + public void timeSmallBytes(int reps) { + measureByteArray(reps, smallBytes); + } + + public void timeMediumBytes(int reps) { + measureByteArray(reps, mediumBytes); + } + + public void timeLargeBytes(int reps) { + measureByteArray(reps, largeBytes); + } + + public void timeSmallShorts(int reps) { + measureShortArray(reps, smallShorts); + } + + public void timeMediumShorts(int reps) { + measureShortArray(reps, mediumShorts); + } + + public void timeLargeShorts(int reps) { + measureShortArray(reps, largeShorts); + } + + public void timeSmallInts(int reps) { + measureIntArray(reps, smallInts); + } + + public void timeMediumInts(int reps) { + measureIntArray(reps, mediumInts); + } + + public void timeLargeInts(int reps) { + measureIntArray(reps, largeInts); + } + + public void timeSmallLongs(int reps) { + measureLongArray(reps, smallLongs); + } + + public void timeMediumLongs(int reps) { + measureLongArray(reps, mediumLongs); + } + + public void timeLargeLongs(int reps) { + measureLongArray(reps, largeLongs); + } + + { + System.loadLibrary("artbenchmark"); + } +} diff --git a/test/998-scoped-primitive-array/check b/test/998-scoped-primitive-array/check deleted file mode 100755 index 842bdc6ae8..0000000000 --- a/test/998-scoped-primitive-array/check +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2015 The Android Open Source Project -# -# 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. - -# Check that the string "error" isn't present -if grep error "$2"; then - exit 1 -else - exit 0 -fi diff --git a/test/998-scoped-primitive-array/expected.txt b/test/998-scoped-primitive-array/expected.txt deleted file mode 100644 index a965a70ed4..0000000000 --- a/test/998-scoped-primitive-array/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/test/998-scoped-primitive-array/scoped_primitive_array.cc b/test/998-scoped-primitive-array/scoped_primitive_array.cc deleted file mode 100644 index c224a06313..0000000000 --- a/test/998-scoped-primitive-array/scoped_primitive_array.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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. - */ - -#include "jni.h" -#include "ScopedPrimitiveArray.h" - -extern "C" JNIEXPORT jlong JNICALL Java_Main_measureByteArray(JNIEnv* env, - jclass, - jlong reps, - jbyteArray arr) { - jlong ret = 0; - for (jlong i = 0; i < reps; ++i) { - ScopedByteArrayRO sc(env, arr); - ret += sc[0] + sc[sc.size() - 1]; - } - return ret; -} - -extern "C" JNIEXPORT jlong JNICALL Java_Main_measureShortArray(JNIEnv* env, - jclass, - jlong reps, - jshortArray arr) { - jlong ret = 0; - for (jlong i = 0; i < reps; ++i) { - ScopedShortArrayRO sc(env, arr); - ret += sc[0] + sc[sc.size() - 1]; - } - return ret; -} - -extern "C" JNIEXPORT jlong JNICALL Java_Main_measureIntArray(JNIEnv* env, - jclass, - jlong reps, - jintArray arr) { - jlong ret = 0; - for (jlong i = 0; i < reps; ++i) { - ScopedIntArrayRO sc(env, arr); - ret += sc[0] + sc[sc.size() - 1]; - } - return ret; -} - -extern "C" JNIEXPORT jlong JNICALL Java_Main_measureLongArray(JNIEnv* env, - jclass, - jlong reps, - jlongArray arr) { - jlong ret = 0; - for (jlong i = 0; i < reps; ++i) { - ScopedLongArrayRO sc(env, arr); - ret += sc[0] + sc[sc.size() - 1]; - } - return ret; -} diff --git a/test/998-scoped-primitive-array/src/Main.java b/test/998-scoped-primitive-array/src/Main.java deleted file mode 100644 index 630e0dc1b6..0000000000 --- a/test/998-scoped-primitive-array/src/Main.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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. - */ - -public class Main { - public Main() {} - - // Measure adds the first and last element of the array by using ScopedPrimitiveArray. - static native long measureByteArray(long reps, byte[] arr); - static native long measureShortArray(long reps, short[] arr); - static native long measureIntArray(long reps, int[] arr); - static native long measureLongArray(long reps, long[] arr); - - static void checkEq(long expected, long value) { - if (expected != value) { - System.out.println("error: Expected " + expected + " but got " + value); - } - } - - static void runPerfTest(long reps) { - for (int length = 1; length <= 8192; length *= 8) { - byte[] bytes = new byte[length]; - bytes[0] = 1; - bytes[length - 1] = 2; - short[] shorts = new short[length]; - shorts[0] = 1; - shorts[length - 1] = 2; - int[] ints = new int[length]; - ints[0] = 1; - ints[length - 1] = 2; - long[] longs = new long[length]; - longs[0] = 1; - longs[length - 1] = 2; - long value = 0; - long elapsed = 0; - long start = 0; - - start = System.nanoTime(); - value = measureByteArray(reps, bytes); - elapsed = System.nanoTime() - start; - System.out.println("Byte length=" + length + " ns/op=" + (double) elapsed / reps); - checkEq(value, reps * (long) (bytes[0] + bytes[length - 1])); - - start = System.nanoTime(); - value = measureShortArray(reps, shorts); - elapsed = System.nanoTime() - start; - System.out.println("Short length=" + length + " ns/op=" + (double) elapsed / reps); - checkEq(value, reps * (long) (shorts[0] + shorts[length - 1])); - - start = System.nanoTime(); - value = measureIntArray(reps, ints); - elapsed = System.nanoTime() - start; - System.out.println("Int length=" + length + " ns/op=" + (double) elapsed / reps); - checkEq(value, reps * (ints[0] + ints[length - 1])); - - start = System.nanoTime(); - value = measureLongArray(reps, longs); - elapsed = System.nanoTime() - start; - System.out.println("Long length=" + length + " ns/op=" + (double) elapsed / reps); - checkEq(value, reps * (longs[0] + longs[length - 1])); - } - } - - public static void main(String[] args) { - System.loadLibrary(args[0]); - long iterations = 2000000; - if (args.length > 1) { - iterations = Long.parseLong(args[1], 10); - } - runPerfTest(iterations); - System.out.println("Done"); - } -} diff --git a/test/999-jni-perf/check b/test/999-jni-perf/check deleted file mode 100755 index ffbb8cf17e..0000000000 --- a/test/999-jni-perf/check +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2014 The Android Open Source Project -# -# 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. - -# Only compare the last line. -tail -n 1 "$2" | diff --strip-trailing-cr -q "$1" - >/dev/null
\ No newline at end of file diff --git a/test/999-jni-perf/expected.txt b/test/999-jni-perf/expected.txt deleted file mode 100644 index a965a70ed4..0000000000 --- a/test/999-jni-perf/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/test/999-jni-perf/src/Main.java b/test/999-jni-perf/src/Main.java deleted file mode 100644 index 032e70011a..0000000000 --- a/test/999-jni-perf/src/Main.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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. - */ - -public class Main { - public Main() { - } - - private static final String MSG = "ABCDE"; - - native int perfJniEmptyCall(); - native int perfSOACall(); - native int perfSOAUncheckedCall(); - - int runPerfTest(long N) { - long start = System.nanoTime(); - for (long i = 0; i < N; i++) { - char c = MSG.charAt(2); - } - long elapse = System.nanoTime() - start; - System.out.println("Fast JNI (charAt): " + (double)elapse / N); - - start = System.nanoTime(); - for (long i = 0; i < N; i++) { - perfJniEmptyCall(); - } - elapse = System.nanoTime() - start; - System.out.println("Empty call: " + (double)elapse / N); - - start = System.nanoTime(); - for (long i = 0; i < N; i++) { - perfSOACall(); - } - elapse = System.nanoTime() - start; - System.out.println("SOA call: " + (double)elapse / N); - - start = System.nanoTime(); - for (long i = 0; i < N; i++) { - perfSOAUncheckedCall(); - } - elapse = System.nanoTime() - start; - System.out.println("SOA unchecked call: " + (double)elapse / N); - - return 0; - } - - public static void main(String[] args) { - System.loadLibrary(args[0]); - long iterations = 1000000; - if (args.length > 1) { - iterations = Long.parseLong(args[1], 10); - } - Main m = new Main(); - m.runPerfTest(iterations); - System.out.println("Done"); - } -} diff --git a/test/Android.libarttest.mk b/test/Android.libarttest.mk index af945fb66e..7f05a043d8 100644 --- a/test/Android.libarttest.mk +++ b/test/Android.libarttest.mk @@ -38,9 +38,7 @@ LIBARTTEST_COMMON_SRC_FILES := \ 457-regs/regs_jni.cc \ 461-get-reference-vreg/get_reference_vreg_jni.cc \ 466-get-live-vreg/get_live_vreg_jni.cc \ - 497-inlining-and-class-loader/clear_dex_cache.cc \ - 998-scoped-primitive-array/scoped_primitive_array.cc \ - 999-jni-perf/perf-jni.cc + 497-inlining-and-class-loader/clear_dex_cache.cc ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttestd.so |