bench: add scrollFeedCompilationMemoryMaxBaselineProfile benchmark

pull/2098/head^2
Tony Medhat 5 months ago
parent 650ada81e8
commit c949907635

@ -17,7 +17,9 @@
package com.google.samples.apps.nowinandroid.foryou
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.ExperimentalMetricApi
import androidx.benchmark.macro.FrameTimingMetric
import androidx.benchmark.macro.MemoryUsageMetric
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
@ -57,4 +59,25 @@ class ScrollForYouFeedBenchmark {
forYouSelectTopics()
forYouScrollFeedDownUp()
}
@Test
fun scrollFeedCompilationMemoryMaxBaselineProfile() = scrollFeedMem(CompilationMode.Partial())
@OptIn(ExperimentalMetricApi::class)
private fun scrollFeedMem(compilationMode: CompilationMode) = benchmarkRule.measureRepeated(
packageName = PACKAGE_NAME,
metrics = listOf(MemoryUsageMetric(MemoryUsageMetric.Mode.Max)),
compilationMode = compilationMode,
iterations = 10,
startupMode = StartupMode.WARM,
setupBlock = {
// Start the app
pressHome()
startActivityAndAllowNotifications()
},
) {
forYouWaitForContent()
forYouSelectTopics()
forYouScrollFeedDownUp()
}
}

Loading…
Cancel
Save