deb: record per-phase build timings, shown by pkh deb profile

Time every Phase the build flow announces through enter_phase — the
chroot bootstrap (tarball download, extraction, finalization), the
apt phases, patch application, the build and binary steps and the
artifact retrieval — and land the ordered profile in the record's
manifest of every run, failed builds included: their profile ends
at the phase the error propagated out of.

Timing rides the enter_phase choke point instead of new measurement
sites, so a phase added later profiles itself. The manifest field
is additive (serde default, skipped when absent), so older manifests
keep loading without a schema bump. The coarse timings stay the
source of the deb list columns: they measure the apt transactions
themselves, where the profile measures whole phases.

pkh deb profile renders a record's profile through the same
read-only record discovery as pkh deb log — the newest record of
the tree, or an id prefix as shown by pkh deb list — so
record_for_log becomes the neutral find_record. Phase keys are
storage names, distinct from the display labels; Phase::from_key
turns them back and a test keeps both in sync.
This commit is contained in:
2026-10-02 14:17:15 +02:00
parent 7055d69152
commit 2ab2ff91e9
8 changed files with 552 additions and 38 deletions
+2
View File
@@ -11,6 +11,7 @@ use std::error::Error;
use std::sync::Arc;
use crate::context::Context;
use crate::deb::BuildProfiler;
use crate::deb::ephemeral::EphemeralContextGuard;
use crate::report::BuildView;
use crate::test::options::TestMode;
@@ -44,6 +45,7 @@ impl Bed {
None,
base_ctx,
view,
&mut BuildProfiler::new(),
)
.await?;
Ok(Bed::Chroot(guard))
+3 -1
View File
@@ -561,7 +561,8 @@ async fn configure_testbed(
}
if !opts.inject.is_empty() {
// Testbed setup is not a timed build: the durations go nowhere.
// Testbed setup is not a profiled build: the durations and the
// phase profile go nowhere.
crate::deb::local::install_injected_packages(
&opts.inject,
env,
@@ -569,6 +570,7 @@ async fn configure_testbed(
view,
&None,
&mut crate::deb::session::BuildTimings::default(),
&mut crate::deb::BuildProfiler::new(),
)?;
}
Ok(())