mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 14:07:05 +05:30
Revert "fix(benchmark): remove startup benchmarks"
This reverts commit fab5cb45c4
.
This commit is contained in:
parent
0d964c4a5d
commit
78f050f115
1 changed files with 58 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2022 Harsh Shandilya.
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
package dev.msfjarvis.claw.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.filters.LargeTest
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.uiautomator.UiDevice
|
||||||
|
import org.junit.Before
|
||||||
|
import org.junit.Rule
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
@LargeTest
|
||||||
|
class BaselineProfileBenchmark {
|
||||||
|
@get:Rule val benchmarkRule = MacrobenchmarkRule()
|
||||||
|
private lateinit var device: UiDevice
|
||||||
|
|
||||||
|
@Before
|
||||||
|
fun setUp() {
|
||||||
|
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||||
|
device = UiDevice.getInstance(instrumentation)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun startupNoCompilation() {
|
||||||
|
startup(CompilationMode.None())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun startupBaselineFullyCompiled() {
|
||||||
|
startup(CompilationMode.Full())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun startupBaselineProfile() {
|
||||||
|
startup(CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startup(compilationMode: CompilationMode) {
|
||||||
|
benchmarkRule.measureRepeated(
|
||||||
|
packageName = PACKAGE_NAME,
|
||||||
|
metrics = listOf(StartupTimingMetric()),
|
||||||
|
iterations = 10,
|
||||||
|
startupMode = StartupMode.COLD,
|
||||||
|
compilationMode = compilationMode
|
||||||
|
) {
|
||||||
|
exploreUI(device)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue