Merge "Correct AdditionPerfTest to return void." am: 4e7f5518f1

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2059947

Change-Id: I61ac0fdf471ae9f00a30a02b13848879144b7b06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Miguel Aranda
2022-04-11 09:07:37 +00:00
committed by Automerger Merge Worker

View File

@@ -37,79 +37,71 @@ public class AdditionPerfTest {
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test @Test
public int timeAddConstantToLocalInt() { public void timeAddConstantToLocalInt() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int result = 0; int result = 0;
while (state.keepRunning()) { while (state.keepRunning()) {
result += 123; result += 123;
} }
return result;
} }
@Test @Test
public int timeAddTwoLocalInts() { public void timeAddTwoLocalInts() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int result = 0; int result = 0;
int constant = 123; int constant = 123;
while (state.keepRunning()) { while (state.keepRunning()) {
result += constant; result += constant;
} }
return result;
} }
@Test @Test
public long timeAddConstantToLocalLong() { public void timeAddConstantToLocalLong() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
long result = 0; long result = 0;
while (state.keepRunning()) { while (state.keepRunning()) {
result += 123L; result += 123L;
} }
return result;
} }
@Test @Test
public long timeAddTwoLocalLongs() { public void timeAddTwoLocalLongs() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
long result = 0; long result = 0;
long constant = 123L; long constant = 123L;
while (state.keepRunning()) { while (state.keepRunning()) {
result += constant; result += constant;
} }
return result;
} }
@Test @Test
public float timeAddConstantToLocalFloat() { public void timeAddConstantToLocalFloat() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
float result = 0.0f; float result = 0.0f;
while (state.keepRunning()) { while (state.keepRunning()) {
result += 123.0f; result += 123.0f;
} }
return result;
} }
@Test @Test
public float timeAddTwoLocalFloats() { public void timeAddTwoLocalFloats() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
float result = 0.0f; float result = 0.0f;
float constant = 123.0f; float constant = 123.0f;
while (state.keepRunning()) { while (state.keepRunning()) {
result += constant; result += constant;
} }
return result;
} }
@Test @Test
public double timeAddConstantToLocalDouble() { public void timeAddConstantToLocalDouble() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
double result = 0.0; double result = 0.0;
while (state.keepRunning()) { while (state.keepRunning()) {
result += 123.0; result += 123.0;
} }
return result;
} }
@Test @Test
public double timeAddTwoLocalDoubles() { public void timeAddTwoLocalDoubles() {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
double result = 0.0; double result = 0.0;
double constant = 123.0; double constant = 123.0;
while (state.keepRunning()) { while (state.keepRunning()) {
result += constant; result += constant;
} }
return result;
} }
} }