diff options
| author | OatmealDome <OatmealDome@users.noreply.github.com> | 2023-12-10 11:17:56 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-10 11:17:56 -0500 |
| commit | d272b0ef84e62ad91bbdc0c5ec10f2f772d455ac (patch) | |
| tree | 58e87455354fc2938f5dbf597155485534539fa5 /Source/Android/benchmark/src/main/java | |
| parent | e2472e4f50c749585ffc200ed8646d258c3627c7 (diff) | |
| parent | 93a5df3b9229490e782c3c290be133c81877b5b3 (diff) | |
Merge pull request #12183 from t895/gradle-kotlin-dsl
Android: Gradle updates
Diffstat (limited to 'Source/Android/benchmark/src/main/java')
| -rw-r--r-- | Source/Android/benchmark/src/main/java/com/dolphin/benchmark/StartupBenchmark.kt | 40 | ||||
| -rw-r--r-- | Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt (renamed from Source/Android/benchmark/src/main/java/com/dolphin/benchmark/BaselineProfileGenerator.kt) | 23 | ||||
| -rw-r--r-- | Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/StartupBenchmarks.kt | 46 |
3 files changed, 58 insertions, 51 deletions
diff --git a/Source/Android/benchmark/src/main/java/com/dolphin/benchmark/StartupBenchmark.kt b/Source/Android/benchmark/src/main/java/com/dolphin/benchmark/StartupBenchmark.kt deleted file mode 100644 index 5ae5d40f6b..0000000000 --- a/Source/Android/benchmark/src/main/java/com/dolphin/benchmark/StartupBenchmark.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.dolphin.benchmark - -import androidx.benchmark.macro.BaselineProfileMode -import androidx.benchmark.macro.CompilationMode -import androidx.benchmark.macro.StartupMode -import androidx.benchmark.macro.StartupTimingMetric -import androidx.benchmark.macro.junit4.MacrobenchmarkRule -import androidx.test.ext.junit.runners.AndroidJUnit4 -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class StartupBenchmark { - @get:Rule - val benchmarkRule = MacrobenchmarkRule() - - @Test - fun startupBaselineProfileDisabled() = startup( - CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Disable, warmupIterations = 1) - ) - - @Test - fun startupBaselineProfile() = startup( - CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require, warmupIterations = 1) - ) - - private fun startup(compilationMode: CompilationMode) = benchmarkRule.measureRepeated( - packageName = "org.dolphinemu.dolphinemu.benchmark", - metrics = listOf(StartupTimingMetric()), - iterations = 10, - compilationMode = compilationMode, - startupMode = StartupMode.COLD, - setupBlock = { - pressHome() - } - ) { - startActivityAndWait() - } -} diff --git a/Source/Android/benchmark/src/main/java/com/dolphin/benchmark/BaselineProfileGenerator.kt b/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt index 366a22ab6a..9bf621d6c1 100644 --- a/Source/Android/benchmark/src/main/java/com/dolphin/benchmark/BaselineProfileGenerator.kt +++ b/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt @@ -1,24 +1,25 @@ -package com.dolphin.benchmark +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.baselineprofile -import androidx.benchmark.macro.ExperimentalBaselineProfilesApi import androidx.benchmark.macro.junit4.BaselineProfileRule -import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.LargeTest import androidx.test.uiautomator.UiSelector import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalBaselineProfilesApi::class) -@RunWith(AndroidJUnit4ClassRunner::class) +@RunWith(AndroidJUnit4::class) +@LargeTest class BaselineProfileGenerator { @get:Rule val rule = BaselineProfileRule() @Test - fun generate() = rule.collectBaselineProfile( - packageName = "org.dolphinemu.dolphinemu.benchmark", - profileBlock = { + fun generate() { + rule.collect("org.dolphinemu.dolphinemu") { pressHome() startActivityAndWait() @@ -26,7 +27,7 @@ class BaselineProfileGenerator { device.pressBack() // Navigate through activities that don't require games - // TODO: Make all activities testable without having games available + // TODO: Make all activities testable without having games available (or use homebrew) // TODO: Use resource strings to support more languages // Navigate to the Settings Activity @@ -38,6 +39,6 @@ class BaselineProfileGenerator { config.click() val userData = device.findObject(UiSelector().textContains("User Data")) userData.clickAndWaitForNewWindow(30_000) - }, - ) + } + } } diff --git a/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/StartupBenchmarks.kt b/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/StartupBenchmarks.kt new file mode 100644 index 0000000000..359a3df584 --- /dev/null +++ b/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/StartupBenchmarks.kt @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.baselineprofile + +import androidx.benchmark.macro.BaselineProfileMode +import androidx.benchmark.macro.CompilationMode +import androidx.benchmark.macro.StartupMode +import androidx.benchmark.macro.StartupTimingMetric +import androidx.benchmark.macro.junit4.MacrobenchmarkRule +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.LargeTest +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +@LargeTest +class StartupBenchmarks { + + @get:Rule + val rule = MacrobenchmarkRule() + + @Test + fun startupCompilationNone() = + benchmark(CompilationMode.None()) + + @Test + fun startupCompilationBaselineProfiles() = + benchmark(CompilationMode.Partial(BaselineProfileMode.Require)) + + private fun benchmark(compilationMode: CompilationMode) { + rule.measureRepeated( + packageName = "org.dolphinemu.dolphinemu", + metrics = listOf(StartupTimingMetric()), + compilationMode = compilationMode, + startupMode = StartupMode.COLD, + iterations = 10, + setupBlock = { + pressHome() + }, + measureBlock = { + startActivityAndWait() + } + ) + } +} |
