engine: the draft trace line checks LELEKA_TRACE_DRAFT itself, as the function did (STRA-338)

trace_draft_line lost its own switch check when the switch became a field of the window loop's decode settings, and
two of its three callers printed a DRAFT line per draft unguarded; the speed A/B with tracing off showed 518 DRAFT
lines on the candidate against none on the base. The function takes the switch again and every caller passes it.
This commit is contained in:
Pavlo Ratushnyi
2026-11-28 12:51:22 +01:00
parent 267c50a45e
commit 81029ecdb4
2 changed files with 8 additions and 5 deletions
@@ -181,7 +181,7 @@ where
self.live()?;
let cell = first.cell;
let c = self.host.draft_first(first, limits, coupled)?;
trace_draft_line(cell, 0, &c);
trace_draft_line(self.decode.trace_draft, (cell, 0), &c);
Ok(c)
}
fn drain_first(&mut self) -> Result<()> {
@@ -175,7 +175,7 @@ where
self.failed = true;
}
if let Ok(c) = &finished {
trace_draft_line(position, accepted_row, c);
trace_draft_line(self.decode.trace_draft, (position, accepted_row), c);
}
finished
}
@@ -224,8 +224,8 @@ where
if draft.is_err() {
self.failed = true;
}
if let (Ok(c), true) = (&draft, self.decode.trace_draft) {
trace_draft_line(position, accepted_row, c);
if let Ok(c) = &draft {
trace_draft_line(self.decode.trace_draft, (position, accepted_row), c);
}
draft
}
@@ -235,7 +235,10 @@ where
/// their probabilities). The draft's numerics
/// are bit-compared across builds and settings by diffing these lines (draft-round identity gate); nothing reads them
/// in production.
pub(super) fn trace_draft_line(position: i64, accepted_row: usize, c: &DraftCompletion) {
pub(super) fn trace_draft_line(on: bool, (position, accepted_row): (i64, usize), c: &DraftCompletion) {
if !on {
return;
}
let bits: Vec<String> = c.probabilities.iter().map(|p| format!("{:08x}", p.to_bits())).collect();
eprintln!(
"DRAFT position={position} accepted_row={accepted_row} cell={} ids={:?} pbits=[{}]",