Split performance benchmark and baseline profile into separate modules.

This commit is contained in:
Cody Henthorne
2026-02-09 14:39:43 -05:00
committed by Greyson Parrelli
parent 3dd5ad2a8a
commit 4a39c7950f
20 changed files with 97494 additions and 31728 deletions

View File

@@ -1,39 +0,0 @@
package org.thoughtcrime.benchmark
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
import org.junit.Rule
import org.junit.Test
/**
* WARNING! THIS WILL WIPE YOUR SIGNAL INSTALL
*
* Test that generates a Baseline profile from a user journey. Our journey is:
* - start the app
* - open a conversation
*/
@RequiresApi(28)
class BaselineProfileGenerator {
@get:Rule
val baselineProfileRule = BaselineProfileRule()
@Test
fun startup() {
var setup = false
baselineProfileRule.collect(
packageName = "org.thoughtcrime.securesms",
profileBlock = {
if (!setup) {
BenchmarkSetup.setup("cold-start", device)
setup = true
}
startActivityAndWait()
device.findObject(By.textContains("Buddy")).click();
device.wait(Until.hasObject(By.textContains("Signal message")), 10_000L)
device.wait(Until.hasObject(By.textContains("Test")), 5_000L)
}
)
}
}

View File

@@ -9,4 +9,4 @@ object BenchmarkSetup {
device.executeShellCommand("am start -W -n org.thoughtcrime.securesms/org.signal.benchmark.BenchmarkSetupActivity --es setup-type $type")
device.wait(Until.hasObject(By.textContains("done")), 25_000L)
}
}
}

View File

@@ -1,6 +1,7 @@
package org.thoughtcrime.benchmark
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.BaselineProfileMode
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.ExperimentalMetricApi
import androidx.benchmark.macro.StartupMode
@@ -30,7 +31,7 @@ class StartupBenchmarks {
@Test
fun coldStartBaselineProfile() {
measureStartup(5, CompilationMode.Partial())
measureStartup(5, CompilationMode.Partial(BaselineProfileMode.Require))
}
@OptIn(ExperimentalMetricApi::class)