feat(benchmark): 拆分 Baseline Profile 与 Startup Profile 生成方法
This commit is contained in:
parent
ade852208b
commit
b242fb8ecc
@ -30,9 +30,10 @@ import org.junit.runner.RunWith
|
|||||||
* `macrobenchmark/build/outputs/connected_android_test_additional_output/`
|
* `macrobenchmark/build/outputs/connected_android_test_additional_output/`
|
||||||
*
|
*
|
||||||
* 说明:
|
* 说明:
|
||||||
* - `includeInStartupProfile = true` 会同时生成两份产物:
|
* - 本文件包含两个生成测试:
|
||||||
* - `*-baseline-prof.txt`:用于 ART 的 AOT 编译优化
|
* - `generateBaselineProfile()`:`includeInStartupProfile = false`,生成 `*-baseline-prof.txt`,用于 ART 的 AOT 编译优化
|
||||||
* - `*-startup-prof.txt`:用于 AGP 的 DEX layout 优化
|
* - `generateAppStartupProfile()`:`includeInStartupProfile = true`,生成 `*-startup-prof.txt`,用于 AGP 的 DEX layout 优化
|
||||||
|
* - 两个测试执行相同的 `runCoreUserJourney()` 交互路径,因此两份 profile 覆盖范围一致
|
||||||
* - `updateBaselineProfile` Task 会分别将它们复制到:
|
* - `updateBaselineProfile` Task 会分别将它们复制到:
|
||||||
* - `core/src/main/baseline-prof.txt`
|
* - `core/src/main/baseline-prof.txt`
|
||||||
* - `core/src/main/baselineProfiles/startup-prof.txt`
|
* - `core/src/main/baselineProfiles/startup-prof.txt`
|
||||||
@ -66,12 +67,29 @@ class BaselineProfileGenerator {
|
|||||||
private fun MacrobenchmarkScope.safeWaitCalendarPager(timeout: Long = 5000): UiObject2? =
|
private fun MacrobenchmarkScope.safeWaitCalendarPager(timeout: Long = 5000): UiObject2? =
|
||||||
device.wait(Until.findObject(By.res("calendar_pager")), timeout)
|
device.wait(Until.findObject(By.res("calendar_pager")), timeout)
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun generateBaselineProfile() {
|
||||||
|
baselineProfileRule.collect(
|
||||||
|
packageName = "plus.rua.project",
|
||||||
|
includeInStartupProfile = false,
|
||||||
|
profileBlock = {
|
||||||
|
runCoreUserJourney()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun generateAppStartupProfile() {
|
fun generateAppStartupProfile() {
|
||||||
baselineProfileRule.collect(
|
baselineProfileRule.collect(
|
||||||
packageName = "plus.rua.project",
|
packageName = "plus.rua.project",
|
||||||
includeInStartupProfile = true,
|
includeInStartupProfile = true,
|
||||||
profileBlock = {
|
profileBlock = {
|
||||||
|
runCoreUserJourney()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun MacrobenchmarkScope.runCoreUserJourney() {
|
||||||
val TAG = "BaselineProfile"
|
val TAG = "BaselineProfile"
|
||||||
|
|
||||||
// ── 1. 冷启动 ──────────────────────────────────────────
|
// ── 1. 冷启动 ──────────────────────────────────────────
|
||||||
@ -182,6 +200,4 @@ class BaselineProfileGenerator {
|
|||||||
|
|
||||||
Log.d(TAG, "Baseline Profile / Startup Profile 生成完成,所有路径已覆盖")
|
Log.d(TAG, "Baseline Profile / Startup Profile 生成完成,所有路径已覆盖")
|
||||||
}
|
}
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user