Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf152c86 authored by Miguel Aranda's avatar Miguel Aranda
Browse files

Migrate SystemArrayCopyPerfTest to BenchmarkRule

This is part of a larger migration effort to move all AndroidX
benchmarks to use BenchmarkRule instead of PerfStatusReporter. I'm starting with this singular benchmark to ensure it works and if there is no issue will then migrate more tests.

Change-Id: I60a5ea3a416f7e83695c487fee8dcfbcd4a34028
parent 92bf8da4
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@

package android.libcore;

import android.perftests.utils.BenchmarkState;
import androidx.benchmark.BenchmarkState;
import androidx.benchmark.junit4.BenchmarkRule;
import android.perftests.utils.PerfStatusReporter;

import androidx.test.filters.LargeTest;
@@ -34,7 +35,8 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class SystemArrayCopyPerfTest {
    @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
    @Rule
    public BenchmarkRule mBenchmarkRule = new BenchmarkRule();

    public static Collection<Object[]> getData() {
        return Arrays.asList(
@@ -51,7 +53,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        char[] src = new char[len];
        char[] dst = new char[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -63,7 +65,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        byte[] src = new byte[len];
        byte[] dst = new byte[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -75,7 +77,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        short[] src = new short[len];
        short[] dst = new short[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -87,7 +89,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        int[] src = new int[len];
        int[] dst = new int[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -99,7 +101,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        long[] src = new long[len];
        long[] dst = new long[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -111,7 +113,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        float[] src = new float[len];
        float[] dst = new float[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -123,7 +125,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        double[] src = new double[len];
        double[] dst = new double[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }
@@ -135,7 +137,7 @@ public class SystemArrayCopyPerfTest {
        final int len = arrayLength;
        boolean[] src = new boolean[len];
        boolean[] dst = new boolean[len];
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        final BenchmarkState state = mBenchmarkRule.getState();
        while (state.keepRunning()) {
            System.arraycopy(src, 0, dst, 0, len);
        }