diff options
author | 2015-09-22 18:14:29 -0700 | |
---|---|---|
committer | 2015-09-22 18:20:10 -0700 | |
commit | 14f8b13d2593770b7f5387a33f6a8400c20aaa8e (patch) | |
tree | 5d4c8b1fac7738ae4541dd572d3f678dd3acf79b /benchmark/jobject-benchmark/src/JObjectBenchmark.java | |
parent | 6a0e05aff612118d45b87473829fd69a595003ba (diff) |
Add benchmark for jobject functions
Measures performance of:
Add/RemoveLocalRef
Add/RemoveGlobalRef
Add/RemoveWeakGlobalRef
Decoding local, weak, global, handle scope jobjects.
N5 results:
benchmark ns linear runtime
AddRemoveGlobal 476.7 ===========================
AddRemoveLocal 42.0 ==
AddRemoveWeakGlobal 519.7 ==============================
DecodeGlobal 69.9 ====
DecodeHandleScopeRef 38.9 ==
DecodeLocal 70.7 ====
DecodeWeakGlobal 119.7 ======
Change-Id: Iba014a9993909ee45fd52ae48d6dea8428a86bf2
Diffstat (limited to 'benchmark/jobject-benchmark/src/JObjectBenchmark.java')
-rw-r--r-- | benchmark/jobject-benchmark/src/JObjectBenchmark.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/benchmark/jobject-benchmark/src/JObjectBenchmark.java b/benchmark/jobject-benchmark/src/JObjectBenchmark.java new file mode 100644 index 0000000000..f4c059c58b --- /dev/null +++ b/benchmark/jobject-benchmark/src/JObjectBenchmark.java @@ -0,0 +1,39 @@ +/* + * 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 JObjectBenchmark extends SimpleBenchmark { + public JObjectBenchmark() { + // Make sure to link methods before benchmark starts. + System.loadLibrary("artbenchmark"); + timeAddRemoveLocal(1); + timeDecodeLocal(1); + timeAddRemoveGlobal(1); + timeDecodeGlobal(1); + timeAddRemoveWeakGlobal(1); + timeDecodeWeakGlobal(1); + timeDecodeHandleScopeRef(1); + } + + public native void timeAddRemoveLocal(int reps); + public native void timeDecodeLocal(int reps); + public native void timeAddRemoveGlobal(int reps); + public native void timeDecodeGlobal(int reps); + public native void timeAddRemoveWeakGlobal(int reps); + public native void timeDecodeWeakGlobal(int reps); + public native void timeDecodeHandleScopeRef(int reps); +} |