summaryrefslogtreecommitdiff
path: root/Source/Android/benchmark/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Android/benchmark/src/main/java/org')
-rw-r--r--Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt44
-rw-r--r--Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/StartupBenchmarks.kt46
2 files changed, 90 insertions, 0 deletions
diff --git a/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt b/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt
new file mode 100644
index 0000000000..9bf621d6c1
--- /dev/null
+++ b/Source/Android/benchmark/src/main/java/org/dolphinemu/baselineprofile/BaselineProfileGenerator.kt
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+package org.dolphinemu.baselineprofile
+
+import androidx.benchmark.macro.junit4.BaselineProfileRule
+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
+
+@RunWith(AndroidJUnit4::class)
+@LargeTest
+class BaselineProfileGenerator {
+
+ @get:Rule
+ val rule = BaselineProfileRule()
+
+ @Test
+ fun generate() {
+ rule.collect("org.dolphinemu.dolphinemu") {
+ pressHome()
+ startActivityAndWait()
+
+ // Dismiss analytics dialog due to issue with finding button
+ device.pressBack()
+
+ // Navigate through activities that don't require games
+ // 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
+ val settings = device.findObject(UiSelector().description("Settings"))
+ settings.clickAndWaitForNewWindow(30_000)
+
+ // Go through settings and to the User Data Activity
+ val config = device.findObject(UiSelector().textContains("Config"))
+ 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()
+ }
+ )
+ }
+}