From 0d78cb4112186b3f14780e4c28dd30367fe21de2 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 10 Jun 2023 02:55:32 +0530 Subject: [PATCH] fix(benchmark): rework baseline profile benchmark --- .../benchmark/BaselineProfileBenchmark.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/benchmark/src/main/kotlin/dev/msfjarvis/claw/benchmark/BaselineProfileBenchmark.kt b/benchmark/src/main/kotlin/dev/msfjarvis/claw/benchmark/BaselineProfileBenchmark.kt index a7c57285..75c95931 100644 --- a/benchmark/src/main/kotlin/dev/msfjarvis/claw/benchmark/BaselineProfileBenchmark.kt +++ b/benchmark/src/main/kotlin/dev/msfjarvis/claw/benchmark/BaselineProfileBenchmark.kt @@ -8,6 +8,7 @@ package dev.msfjarvis.claw.benchmark import androidx.benchmark.macro.BaselineProfileMode import androidx.benchmark.macro.CompilationMode +import androidx.benchmark.macro.FrameTimingMetric import androidx.benchmark.macro.StartupMode import androidx.benchmark.macro.StartupTimingMetric import androidx.benchmark.macro.junit4.MacrobenchmarkRule @@ -28,27 +29,27 @@ class BaselineProfileBenchmark { } @Test - fun startupNoCompilation() { - startup(CompilationMode.None()) + fun noCompilation() { + exploreUI(CompilationMode.None()) } @Test - fun startupBaselineFullyCompiled() { - startup(CompilationMode.Full()) + fun fullyCompiled() { + exploreUI(CompilationMode.Full()) } @Test - fun startupBaselineProfile() { - startup(CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require)) + fun baselineProfile() { + exploreUI(CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require)) } - private fun startup(compilationMode: CompilationMode) { + private fun exploreUI(compilationMode: CompilationMode) { benchmarkRule.measureRepeated( packageName = PACKAGE_NAME, - metrics = listOf(StartupTimingMetric()), - iterations = 10, + metrics = listOf(FrameTimingMetric(), StartupTimingMetric()), + compilationMode = compilationMode, startupMode = StartupMode.COLD, - compilationMode = compilationMode + iterations = 10, ) { device.executeShellCommand("pm clear $PACKAGE_NAME")