Set task profile when running compilation VM
Use the new VMCompilationPerformance profile when running the
compilation VM to speed up. To do so, VirtualMachine{App|Raw}Config
parcelables are extended and the vm tool was also extended to accept
"--task-profiles" flag.
Bug: 223790172
Test: adb shell /apex/com.android.compos/bin/composd_cmd test-compile
Change-Id: I4b24ea353b6f93316ecdfe1023b3b8d315d57cc8
diff --git a/compos/common/compos_client.rs b/compos/common/compos_client.rs
index 16dc2cf..839280c 100644
--- a/compos/common/compos_client.rs
+++ b/compos/common/compos_client.rs
@@ -64,6 +64,8 @@
/// Comma separated list of host CPUs where vCPUs are assigned to. If None, any host CPU can be
/// used to run any vCPU.
pub cpu_set: Option<String>,
+ /// List of task profiles to apply to the VM
+ pub task_profiles: Vec<String>,
/// If present, overrides the path to the VM config JSON file
pub config_path: Option<String>,
/// If present, overrides the amount of RAM to give the VM
@@ -137,6 +139,7 @@
memoryMib: parameters.memory_mib.unwrap_or(0), // 0 means use the default
numCpus: parameters.cpus.map_or(1, NonZeroU32::get) as i32,
cpuAffinity: parameters.cpu_set.clone(),
+ taskProfiles: parameters.task_profiles.clone(),
});
let vm = service
diff --git a/compos/composd/src/instance_manager.rs b/compos/composd/src/instance_manager.rs
index 587314c..60bf20f 100644
--- a/compos/composd/src/instance_manager.rs
+++ b/compos/composd/src/instance_manager.rs
@@ -98,7 +98,14 @@
}
};
let cpu_set = system_properties::read(DEX2OAT_CPU_SET_PROP_NAME)?;
- Ok(VmParameters { cpus, cpu_set, memory_mib: Some(VM_MEMORY_MIB), ..Default::default() })
+ let task_profiles = vec!["VMCompilationPerformance".to_string()];
+ Ok(VmParameters {
+ cpus,
+ cpu_set,
+ task_profiles,
+ memory_mib: Some(VM_MEMORY_MIB),
+ ..Default::default()
+ })
}
// Ensures we only run one instance at a time.