mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
fix(benchmark): rework baseline profile benchmark
This commit is contained in:
parent
7c59130af9
commit
0d78cb4112
1 changed files with 11 additions and 10 deletions
|
@ -8,6 +8,7 @@ package dev.msfjarvis.claw.benchmark
|
||||||
|
|
||||||
import androidx.benchmark.macro.BaselineProfileMode
|
import androidx.benchmark.macro.BaselineProfileMode
|
||||||
import androidx.benchmark.macro.CompilationMode
|
import androidx.benchmark.macro.CompilationMode
|
||||||
|
import androidx.benchmark.macro.FrameTimingMetric
|
||||||
import androidx.benchmark.macro.StartupMode
|
import androidx.benchmark.macro.StartupMode
|
||||||
import androidx.benchmark.macro.StartupTimingMetric
|
import androidx.benchmark.macro.StartupTimingMetric
|
||||||
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
|
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
|
||||||
|
@ -28,27 +29,27 @@ class BaselineProfileBenchmark {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun startupNoCompilation() {
|
fun noCompilation() {
|
||||||
startup(CompilationMode.None())
|
exploreUI(CompilationMode.None())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun startupBaselineFullyCompiled() {
|
fun fullyCompiled() {
|
||||||
startup(CompilationMode.Full())
|
exploreUI(CompilationMode.Full())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun startupBaselineProfile() {
|
fun baselineProfile() {
|
||||||
startup(CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require))
|
exploreUI(CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startup(compilationMode: CompilationMode) {
|
private fun exploreUI(compilationMode: CompilationMode) {
|
||||||
benchmarkRule.measureRepeated(
|
benchmarkRule.measureRepeated(
|
||||||
packageName = PACKAGE_NAME,
|
packageName = PACKAGE_NAME,
|
||||||
metrics = listOf(StartupTimingMetric()),
|
metrics = listOf(FrameTimingMetric(), StartupTimingMetric()),
|
||||||
iterations = 10,
|
compilationMode = compilationMode,
|
||||||
startupMode = StartupMode.COLD,
|
startupMode = StartupMode.COLD,
|
||||||
compilationMode = compilationMode
|
iterations = 10,
|
||||||
) {
|
) {
|
||||||
device.executeShellCommand("pm clear $PACKAGE_NAME")
|
device.executeShellCommand("pm clear $PACKAGE_NAME")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue