-
-
Save skydoves/89b15a25216aa963b02cb64814763794 to your computer and use it in GitHub Desktop.
startup_benchmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "YOUR_APPLICATION_PACKAGE_NAME", | |
metrics = listOf(StartupTimingMetric()), | |
compilationMode = compilationMode, | |
startupMode = StartupMode.COLD, | |
iterations = 10, | |
setupBlock = { | |
pressHome() | |
}, | |
measureBlock = { | |
startActivityAndWait() | |
device.waitForIdle() | |
// app sceniarios | |
}, | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment