From ed2d6ea903257ae5cb1ac4af7eba3f65b7cb47c3 Mon Sep 17 00:00:00 2001 From: Clark Date: Fri, 10 Mar 2023 17:34:15 -0500 Subject: [PATCH] Only setup mock data once for baseline profiles and benchmarks. --- .../thoughtcrime/benchmark/BaselineProfileGenerator.kt | 8 +++++--- .../java/org/thoughtcrime/benchmark/StartupBenchmarks.kt | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/benchmark/src/main/java/org/thoughtcrime/benchmark/BaselineProfileGenerator.kt b/benchmark/src/main/java/org/thoughtcrime/benchmark/BaselineProfileGenerator.kt index b05f410c47..3bb26d2f65 100644 --- a/benchmark/src/main/java/org/thoughtcrime/benchmark/BaselineProfileGenerator.kt +++ b/benchmark/src/main/java/org/thoughtcrime/benchmark/BaselineProfileGenerator.kt @@ -26,10 +26,12 @@ class BaselineProfileGenerator { fun startup() = baselineProfileRule.collectBaselineProfile( packageName = "org.thoughtcrime.securesms", profileBlock = { - val setupIntent = Intent().apply { - component = ComponentName("org.thoughtcrime.securesms", "org.signal.benchmark.BenchmarkSetupActivity") + if (iteration == 0) { + val setupIntent = Intent().apply { + component = ComponentName("org.thoughtcrime.securesms", "org.signal.benchmark.BenchmarkSetupActivity") + } + startActivityAndWait(setupIntent) } - startActivityAndWait(setupIntent) startActivityAndWait() device.findObject(By.textContains("Buddy")).click(); device.wait( diff --git a/benchmark/src/main/java/org/thoughtcrime/benchmark/StartupBenchmarks.kt b/benchmark/src/main/java/org/thoughtcrime/benchmark/StartupBenchmarks.kt index 7ea8b49726..5cd6eca1dc 100644 --- a/benchmark/src/main/java/org/thoughtcrime/benchmark/StartupBenchmarks.kt +++ b/benchmark/src/main/java/org/thoughtcrime/benchmark/StartupBenchmarks.kt @@ -52,7 +52,11 @@ class StartupBenchmarks { iterations = iterations, startupMode = StartupMode.COLD, compilationMode = compilationMode, - setupBlock = fakeDataSetupBlock + setupBlock = { + if (compilationMode !is CompilationMode.Partial || iteration == 0) { + fakeDataSetupBlock() + } + } ) { pressHome() startActivityAndWait()