Android: Baseline profile generation

This creates a new benchmark module that is responsible for generating baseline profiles and testing them. As part of this commit a baseline-prof.txt file has been included to speed up launch times with the app in its current state. Later, profile generation can be automated and keep up with the app as it changes.
This commit is contained in:
Charles Lombardo
2022-12-09 12:13:34 -05:00
parent 61c10a5644
commit 974003888a
10 changed files with 4085 additions and 1 deletions

View File

@ -0,0 +1,73 @@
import com.android.build.api.dsl.ManagedVirtualDevice
plugins {
id 'com.android.test'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.dolphin.benchmark'
compileSdk 33
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
defaultConfig {
minSdk 23
targetSdk 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
testOptions {
managedDevices {
devices {
pixel2Api31 (ManagedVirtualDevice) {
device = "Pixel 2"
apiLevel = 31
systemImageSource = "aosp"
}
}
}
}
buildTypes {
// This benchmark buildType is used for benchmarking, and should function like your
// release build (for example, with minification on). It's signed with a debug key
// for easy local/CI testing.
benchmark {
signingConfig signingConfigs.debug
matchingFallbacks = ['release']
debuggable true
applicationIdSuffix ".benchmark"
versionNameSuffix '-benchmark'
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
minifyEnabled true
shrinkResources true
}
}
targetProjectPath = ":app"
experimentalProperties["android.experimental.self-instrumenting"] = true
}
dependencies {
implementation 'androidx.test.ext:junit:1.1.4'
implementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
implementation 'androidx.benchmark:benchmark-macro-junit4:1.1.1'
}
androidComponents {
beforeVariants(selector().all()) {
enabled = buildType == "benchmark"
}
}