Add interpreted (jit-disabled) mode to Macrobenchmarks (2/2)
Bug: 183660125
Test: tests in benchmark.integration.macrobenchmark, with and without interpreted mode
This change makes all existing Macrobenchmarks sweep across
compilation modes, including the new CompilationMode.Interpreted.
This will enable measuring worst-case macrobenchmark performance,
performance before JIT has a chance to run.
Removes ProcessSpeedProfileValidation, as it's now redundant with the
other parameterized benchmarks.
Change-Id: I552ba2f3185eb50fe19f74a26350a6095670cd3a
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/MacrobenchUtils.kt b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/MacrobenchUtils.kt
new file mode 100644
index 0000000..8a3b2aa
--- /dev/null
+++ b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/MacrobenchUtils.kt
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2020 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.
+ */
+
+package androidx.benchmark.integration.macrobenchmark
+
+import android.content.Intent
+import androidx.benchmark.macro.CompilationMode
+import androidx.benchmark.macro.StartupMode
+import androidx.benchmark.macro.StartupTimingMetric
+import androidx.benchmark.macro.isSupportedWithVmSettings
+import androidx.benchmark.macro.junit4.MacrobenchmarkRule
+
+const val TARGET_PACKAGE = "androidx.benchmark.integration.macrobenchmark.target"
+
+fun MacrobenchmarkRule.measureStartup(
+ compilationMode: CompilationMode,
+ startupMode: StartupMode,
+ iterations: Int = 3,
+ setupIntent: Intent.() -> Unit = {}
+) = measureRepeated(
+ packageName = TARGET_PACKAGE,
+ metrics = listOf(StartupTimingMetric()),
+ compilationMode = compilationMode,
+ iterations = iterations,
+ startupMode = startupMode
+) {
+ pressHome()
+ val intent = Intent()
+ intent.setPackage(TARGET_PACKAGE)
+ setupIntent(intent)
+ startActivityAndWait(intent)
+}
+
+fun createStartupCompilationParams(
+ startupModes: List<StartupMode> = listOf(StartupMode.HOT, StartupMode.WARM, StartupMode.COLD),
+ compilationModes: List<CompilationMode> = listOf(
+ CompilationMode.None,
+ CompilationMode.Interpreted,
+ CompilationMode.SpeedProfile()
+ )
+): List<Array<Any>> = mutableListOf<Array<Any>>().apply {
+ for (startupMode in startupModes) {
+ for (compilationMode in compilationModes) {
+ // Skip configs that can't run, so they don't clutter Studio benchmark
+ // output with AssumptionViolatedException dumps
+ if (compilationMode.isSupportedWithVmSettings()) {
+ add(arrayOf(startupMode, compilationMode))
+ }
+ }
+ }
+}
+
+fun createCompilationParams(
+ compilationModes: List<CompilationMode> = listOf(
+ CompilationMode.None,
+ CompilationMode.Interpreted,
+ CompilationMode.SpeedProfile()
+ )
+): List<Array<Any>> = mutableListOf<Array<Any>>().apply {
+ for (compilationMode in compilationModes) {
+ // Skip configs that can't run, so they don't clutter Studio benchmark
+ // output with AssumptionViolatedException dumps
+ if (compilationMode.isSupportedWithVmSettings()) {
+ add(arrayOf(compilationMode))
+ }
+ }
+}
\ No newline at end of file
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/ProcessSpeedProfileValidation.kt b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
deleted file mode 100644
index d4be8d52..0000000
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-package androidx.benchmark.integration.macrobenchmark
-
-import androidx.benchmark.macro.CompilationMode
-import androidx.benchmark.macro.StartupMode
-import androidx.benchmark.macro.StartupTimingMetric
-import androidx.benchmark.macro.junit4.MacrobenchmarkRule
-import androidx.test.filters.LargeTest
-import androidx.test.filters.SdkSuppress
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
-
-@LargeTest
-@SdkSuppress(minSdkVersion = 29)
-@RunWith(Parameterized::class)
-class ProcessSpeedProfileValidation(
- private val compilationMode: CompilationMode,
- private val startupMode: StartupMode
-) {
- @get:Rule
- val benchmarkRule = MacrobenchmarkRule()
-
- @Test
- fun start() = benchmarkRule.measureRepeated(
- packageName = PACKAGE_NAME,
- metrics = listOf(StartupTimingMetric()),
- compilationMode = compilationMode,
- iterations = 3,
- startupMode = startupMode
- ) {
- pressHome()
- startActivityAndWait()
- }
-
- companion object {
- private const val PACKAGE_NAME = "androidx.benchmark.integration.macrobenchmark.target"
-
- @Parameterized.Parameters(name = "compilation_mode={0}, startup_mode={1}")
- @JvmStatic
- fun kilProcessParameters(): List<Array<Any>> {
- val compilationModes = listOf(
- CompilationMode.None,
- CompilationMode.SpeedProfile(warmupIterations = 3)
- )
- val processKillOptions = listOf(StartupMode.WARM, StartupMode.COLD)
- return compilationModes.zip(processKillOptions).map {
- arrayOf(it.first, it.second)
- }
- }
- }
-}
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/SmallListStartupBenchmark.kt b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/SmallListStartupBenchmark.kt
index 742d7dc..553c577 100644
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/SmallListStartupBenchmark.kt
+++ b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/SmallListStartupBenchmark.kt
@@ -16,6 +16,7 @@
package androidx.benchmark.integration.macrobenchmark
+import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.filters.LargeTest
@@ -26,13 +27,16 @@
@LargeTest
@RunWith(Parameterized::class)
-class SmallListStartupBenchmark(private val startupMode: StartupMode) {
+class SmallListStartupBenchmark(
+ private val startupMode: StartupMode,
+ private val compilationMode: CompilationMode
+) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startup() = benchmarkRule.measureStartup(
- profileCompiled = true,
+ compilationMode = compilationMode,
startupMode = startupMode
) {
action = "androidx.benchmark.integration.macrobenchmark.target.RECYCLER_VIEW"
@@ -40,11 +44,8 @@
}
companion object {
- @Parameterized.Parameters(name = "mode={0}")
+ @Parameterized.Parameters(name = "startup={0},compilation={1}")
@JvmStatic
- fun parameters(): List<Array<Any>> {
- return listOf(StartupMode.COLD, StartupMode.WARM)
- .map { arrayOf(it) }
- }
+ fun parameters() = createStartupCompilationParams()
}
}
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/StartupUtils.kt b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/StartupUtils.kt
deleted file mode 100644
index f07501f..0000000
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/StartupUtils.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-package androidx.benchmark.integration.macrobenchmark
-
-import android.content.Intent
-import androidx.benchmark.macro.CompilationMode
-import androidx.benchmark.macro.StartupMode
-import androidx.benchmark.macro.StartupTimingMetric
-import androidx.benchmark.macro.junit4.MacrobenchmarkRule
-
-const val TARGET_PACKAGE = "androidx.benchmark.integration.macrobenchmark.target"
-
-fun MacrobenchmarkRule.measureStartup(
- profileCompiled: Boolean,
- startupMode: StartupMode,
- iterations: Int = 3,
- setupIntent: Intent.() -> Unit = {}
-) = measureRepeated(
- packageName = "androidx.benchmark.integration.macrobenchmark.target",
- metrics = listOf(StartupTimingMetric()),
- compilationMode = if (profileCompiled) {
- CompilationMode.SpeedProfile(warmupIterations = 3)
- } else {
- CompilationMode.None
- },
- iterations = iterations,
- startupMode = startupMode
-) {
- pressHome()
- val intent = Intent()
- intent.setPackage(TARGET_PACKAGE)
- setupIntent(intent)
- startActivityAndWait(intent)
-}
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/FrameTimingMetricValidation.kt b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialListScrollBenchmark.kt
similarity index 89%
rename from benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/FrameTimingMetricValidation.kt
rename to benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialListScrollBenchmark.kt
index b9ce5d4..62ede92 100644
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/FrameTimingMetricValidation.kt
+++ b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialListScrollBenchmark.kt
@@ -35,7 +35,7 @@
@LargeTest
@SdkSuppress(minSdkVersion = 29)
@RunWith(Parameterized::class)
-class FrameTimingMetricValidation(
+class TrivialListScrollBenchmark(
private val compilationMode: CompilationMode
) {
@get:Rule
@@ -79,13 +79,8 @@
"androidx.benchmark.integration.macrobenchmark.target.RECYCLER_VIEW"
private const val RESOURCE_ID = "recycler"
- @Parameterized.Parameters(name = "compilation_mode={0}")
+ @Parameterized.Parameters(name = "compilation={0}")
@JvmStatic
- fun jankParameters(): List<Array<Any>> {
- return listOf(
- CompilationMode.None,
- CompilationMode.SpeedProfile(warmupIterations = 3)
- ).map { arrayOf(it) }
- }
+ fun parameters() = createCompilationParams()
}
}
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialStartupBenchmark.kt b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialStartupBenchmark.kt
index e62457a..29d9be3 100644
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialStartupBenchmark.kt
+++ b/benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialStartupBenchmark.kt
@@ -16,6 +16,7 @@
package androidx.benchmark.integration.macrobenchmark
+import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.filters.LargeTest
@@ -26,24 +27,24 @@
@LargeTest
@RunWith(Parameterized::class)
-class TrivialStartupBenchmark(private val startupMode: StartupMode) {
+class TrivialStartupBenchmark(
+ private val startupMode: StartupMode,
+ private val compilationMode: CompilationMode
+) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startup() = benchmarkRule.measureStartup(
- profileCompiled = true,
+ compilationMode = compilationMode,
startupMode = startupMode
) {
action = "androidx.benchmark.integration.macrobenchmark.target.TRIVIAL_STARTUP_ACTIVITY"
}
companion object {
- @Parameterized.Parameters(name = "mode={0}")
+ @Parameterized.Parameters(name = "startup={0},compilation={1}")
@JvmStatic
- fun parameters(): List<Array<Any>> {
- return listOf(StartupMode.COLD, StartupMode.WARM, StartupMode.HOT)
- .map { arrayOf(it) }
- }
+ fun parameters() = createStartupCompilationParams()
}
}
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
deleted file mode 100644
index 43a0f581..0000000
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/ProcessSpeedProfileValidation.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-package androidx.compose.integration.macrobenchmark
-
-import androidx.benchmark.macro.CompilationMode
-import androidx.benchmark.macro.StartupMode
-import androidx.benchmark.macro.StartupTimingMetric
-import androidx.benchmark.macro.junit4.MacrobenchmarkRule
-import androidx.test.filters.LargeTest
-import androidx.test.filters.SdkSuppress
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
-
-/**
- * Macrobenchmark used for local validation of performance numbers coming from MacrobenchmarkRule.
- */
-@LargeTest
-@SdkSuppress(minSdkVersion = 29)
-@RunWith(Parameterized::class)
-class ProcessSpeedProfileValidation(
- private val compilationMode: CompilationMode,
- private val startupMode: StartupMode
-) {
- @get:Rule
- val benchmarkRule = MacrobenchmarkRule()
-
- @Test
- fun start() = benchmarkRule.measureRepeated(
- packageName = PACKAGE_NAME,
- metrics = listOf(StartupTimingMetric()),
- compilationMode = compilationMode,
- iterations = 3,
- startupMode = startupMode
- ) {
- pressHome()
- startActivityAndWait()
- }
-
- companion object {
- private const val PACKAGE_NAME = "androidx.compose.integration.macrobenchmark.target"
-
- @Parameterized.Parameters(name = "compilation_mode={0}, startup_mode={1}")
- @JvmStatic
- fun kilProcessParameters(): List<Array<Any>> {
- val compilationModes = listOf(
- CompilationMode.None,
- CompilationMode.SpeedProfile(warmupIterations = 3)
- )
- val processKillOptions = listOf(StartupMode.WARM, StartupMode.COLD)
- return compilationModes.zip(processKillOptions).map {
- arrayOf(it.first, it.second)
- }
- }
- }
-}
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
index 1a35bf5..56696de 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
@@ -16,6 +16,9 @@
package androidx.compose.integration.macrobenchmark
+import androidx.benchmark.integration.macrobenchmark.createStartupCompilationParams
+import androidx.benchmark.integration.macrobenchmark.measureStartup
+import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.filters.LargeTest
@@ -26,13 +29,16 @@
@LargeTest
@RunWith(Parameterized::class)
-class SmallListStartupBenchmark(private val startupMode: StartupMode) {
+class SmallListStartupBenchmark(
+ private val startupMode: StartupMode,
+ private val compilationMode: CompilationMode
+) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startup() = benchmarkRule.measureStartup(
- profileCompiled = true,
+ compilationMode = compilationMode,
startupMode = startupMode
) {
action = "androidx.compose.integration.macrobenchmark.target.LAZY_COLUMN_ACTIVITY"
@@ -40,11 +46,8 @@
}
companion object {
- @Parameterized.Parameters(name = "mode={0}")
+ @Parameterized.Parameters(name = "startup={0},compilation={1}")
@JvmStatic
- fun parameters(): List<Array<Any>> {
- return listOf(StartupMode.COLD, StartupMode.WARM)
- .map { arrayOf(it) }
- }
+ fun parameters() = createStartupCompilationParams()
}
}
\ No newline at end of file
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt
index dfbb035..5f26ee6 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/StartupUtils.kt
@@ -14,39 +14,67 @@
* limitations under the License.
*/
-package androidx.compose.integration.macrobenchmark
+package androidx.benchmark.integration.macrobenchmark
import android.content.Intent
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.StartupTimingMetric
+import androidx.benchmark.macro.isSupportedWithVmSettings
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
-const val TargetPackage = "androidx.compose.integration.macrobenchmark.target"
+const val TARGET_PACKAGE = "androidx.benchmark.integration.compose.target"
-/**
- * Simplified interface for standardizing e.g. package,
- * compilation types, and iteration count across project
- */
fun MacrobenchmarkRule.measureStartup(
- profileCompiled: Boolean,
+ compilationMode: CompilationMode,
startupMode: StartupMode,
- iterations: Int = 5,
+ iterations: Int = 3,
setupIntent: Intent.() -> Unit = {}
) = measureRepeated(
- packageName = TargetPackage,
+ packageName = TARGET_PACKAGE,
metrics = listOf(StartupTimingMetric()),
- compilationMode = if (profileCompiled) {
- CompilationMode.SpeedProfile(warmupIterations = 3)
- } else {
- CompilationMode.None
- },
+ compilationMode = compilationMode,
iterations = iterations,
startupMode = startupMode
) {
pressHome()
val intent = Intent()
- intent.setPackage(TargetPackage)
+ intent.setPackage(TARGET_PACKAGE)
setupIntent(intent)
startActivityAndWait(intent)
+}
+
+fun createStartupCompilationParams(
+ startupModes: List<StartupMode> = listOf(StartupMode.HOT, StartupMode.WARM, StartupMode.COLD),
+ compilationModes: List<CompilationMode> = listOf(
+ CompilationMode.None,
+ CompilationMode.Interpreted,
+ CompilationMode.SpeedProfile()
+ )
+): List<Array<Any>> = mutableListOf<Array<Any>>().apply {
+ for (startupMode in startupModes) {
+ for (compilationMode in compilationModes) {
+ // Skip configs that can't run, so they don't clutter Studio benchmark
+ // output with AssumptionViolatedException dumps
+ if (compilationMode.isSupportedWithVmSettings()) {
+ add(arrayOf(startupMode, compilationMode))
+ }
+ }
+ }
+}
+
+fun createCompilationParams(
+ compilationModes: List<CompilationMode> = listOf(
+ CompilationMode.None,
+ CompilationMode.Interpreted,
+ CompilationMode.SpeedProfile()
+ )
+): List<Array<Any>> = mutableListOf<Array<Any>>().apply {
+ for (compilationMode in compilationModes) {
+ // Skip configs that can't run, so they don't clutter Studio benchmark
+ // output with AssumptionViolatedException dumps
+ if (compilationMode.isSupportedWithVmSettings()) {
+ add(arrayOf(compilationMode))
+ }
+ }
}
\ No newline at end of file
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/FrameTimingMetricValidation.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt
similarity index 88%
rename from compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/FrameTimingMetricValidation.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt
index bf96acd..0e97a25 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/FrameTimingMetricValidation.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt
@@ -18,6 +18,7 @@
import android.content.Intent
import android.graphics.Point
+import androidx.benchmark.integration.macrobenchmark.createCompilationParams
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.FrameTimingMetric
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
@@ -34,7 +35,9 @@
@LargeTest
@RunWith(Parameterized::class)
-class FrameTimingMetricValidation(private val compilationMode: CompilationMode) {
+class TrivialListScrollBenchmark(
+ private val compilationMode: CompilationMode
+) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@@ -78,13 +81,8 @@
private const val COMPOSE_IDLE = "COMPOSE-IDLE"
- @Parameterized.Parameters(name = "compilation_mode={0}")
+ @Parameterized.Parameters(name = "compilation={0}")
@JvmStatic
- fun jankParameters(): List<Array<Any>> {
- return listOf(
- CompilationMode.None,
- CompilationMode.SpeedProfile(warmupIterations = 3)
- ).map { arrayOf(it) }
- }
+ fun parameters() = createCompilationParams()
}
}
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
index 9ebb6ed..3b0e076 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
@@ -16,6 +16,9 @@
package androidx.compose.integration.macrobenchmark
+import androidx.benchmark.integration.macrobenchmark.createStartupCompilationParams
+import androidx.benchmark.integration.macrobenchmark.measureStartup
+import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.filters.LargeTest
@@ -26,24 +29,24 @@
@LargeTest
@RunWith(Parameterized::class)
-class TrivialStartupBenchmark(private val startupMode: StartupMode) {
+class TrivialStartupBenchmark(
+ private val startupMode: StartupMode,
+ private val compilationMode: CompilationMode
+) {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startup() = benchmarkRule.measureStartup(
- profileCompiled = true,
+ compilationMode = compilationMode,
startupMode = startupMode
) {
action = "androidx.compose.integration.macrobenchmark.target.TRIVIAL_STARTUP_ACTIVITY"
}
companion object {
- @Parameterized.Parameters(name = "mode={0}")
+ @Parameterized.Parameters(name = "startup={0},compilation={1}")
@JvmStatic
- fun parameters(): List<Array<Any>> {
- return listOf(StartupMode.COLD, StartupMode.WARM, StartupMode.HOT)
- .map { arrayOf(it) }
- }
+ fun parameters() = createStartupCompilationParams()
}
}