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/vm/src/main.rs b/vm/src/main.rs
index 80ea9be..8b438b4 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -92,6 +92,10 @@
#[structopt(long)]
cpu_affinity: Option<String>,
+ /// Comma separated list of task profile names to apply to the VM
+ #[structopt(long)]
+ task_profiles: Vec<String>,
+
/// Paths to extra idsig files.
#[structopt(long = "extra-idsig")]
extra_idsigs: Vec<PathBuf>,
@@ -118,6 +122,10 @@
#[structopt(long)]
cpu_affinity: Option<String>,
+ /// Comma separated list of task profile names to apply to the VM
+ #[structopt(long)]
+ task_profiles: Vec<String>,
+
/// Path to file for VM console output.
#[structopt(long)]
console: Option<PathBuf>,
@@ -200,6 +208,7 @@
mem,
cpus,
cpu_affinity,
+ task_profiles,
extra_idsigs,
} => command_run_app(
service,
@@ -215,9 +224,10 @@
mem,
cpus,
cpu_affinity,
+ task_profiles,
&extra_idsigs,
),
- Opt::Run { config, daemonize, cpus, cpu_affinity, console, log } => {
+ Opt::Run { config, daemonize, cpus, cpu_affinity, task_profiles, console, log } => {
command_run(
service,
&config,
@@ -227,6 +237,7 @@
/* mem */ None,
cpus,
cpu_affinity,
+ task_profiles,
)
}
Opt::Stop { cid } => command_stop(service, cid),
diff --git a/vm/src/run.rs b/vm/src/run.rs
index ef38d7d..3d3d703 100644
--- a/vm/src/run.rs
+++ b/vm/src/run.rs
@@ -54,6 +54,7 @@
mem: Option<u32>,
cpus: Option<u32>,
cpu_affinity: Option<String>,
+ task_profiles: Vec<String>,
extra_idsigs: &[PathBuf],
) -> Result<(), Error> {
let extra_apks = parse_extra_apk_list(apk, config_path)?;
@@ -105,6 +106,7 @@
memoryMib: mem.unwrap_or(0) as i32, // 0 means use the VM default
numCpus: cpus.unwrap_or(1) as i32,
cpuAffinity: cpu_affinity,
+ taskProfiles: task_profiles,
});
run(
service,
@@ -127,6 +129,7 @@
mem: Option<u32>,
cpus: Option<u32>,
cpu_affinity: Option<String>,
+ task_profiles: Vec<String>,
) -> Result<(), Error> {
let config_file = File::open(config_path).context("Failed to open config file")?;
let mut config =
@@ -138,6 +141,7 @@
config.numCpus = cpus as i32;
}
config.cpuAffinity = cpu_affinity;
+ config.taskProfiles = task_profiles;
run(
service,
&VirtualMachineConfig::RawConfig(config),