Skip to content

Commit 6615594

Browse files
committed
fix a units error, log more about parallelism determination
1 parent f9d25ca commit 6615594

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

phd-tests/runner/src/main.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ fn guess_max_reasonable_parallelism(
8888
// than the test runner itself. Overprovisioning CPUs will make everyone
8989
// sad but should not fail tests, at least...
9090
let lim_by_cpus = online_cpus / cpus_per_runner;
91+
into!(
92+
"parallelism by cpu count: {} ({} / {})",
93+
lim_by_cpus,
94+
online_cpus,
95+
cpus_per_runner
96+
);
9197

9298
let ctl = bhyve_api::VmmCtlFd::open()?;
9399
let reservoir =
@@ -109,7 +115,9 @@ fn guess_max_reasonable_parallelism(
109115
.try_into()
110116
.expect("physical page count is reasonable");
111117

112-
let installed_mb = page_size * total_pages;
118+
const MiB: usize = 1024 * 1024;
119+
120+
let installed_mb = page_size * total_pages / MiB;
113121
// /!\ Arbitrary choice warning /!\
114122
//
115123
// It would be a little rude to spawn so many VMs that we cause the
@@ -119,7 +127,7 @@ fn guess_max_reasonable_parallelism(
119127
// fraction.
120128
vmm_mem_limit = installed_mb / 4;
121129

122-
eprintln!(
130+
warn!(
123131
"phd-runner sees the VMM reservior is unconfigured, and will use \
124132
up to 25% of system memory ({}MiB) for test VMs. Please consider \
125133
using `cargo run --bin rsrvrctl set <size MiB>` to set aside \
@@ -129,6 +137,12 @@ fn guess_max_reasonable_parallelism(
129137
}
130138

131139
let lim_by_mem = vmm_mem_limit / memory_mib_per_runner;
140+
into!(
141+
"parallelism by memory: {} ({} / {})",
142+
lim_by_mem,
143+
vmm_mem_limit,
144+
memory_mib_per_runner
145+
);
132146

133147
Ok(std::cmp::min(lim_by_cpus as u16, lim_by_mem as u16))
134148
}

0 commit comments

Comments
 (0)