Skip to main content

minimize_ticks

Function minimize_ticks 

Source
pub fn minimize_ticks<F>(
    reproduce_fn: F,
    max_ticks: u64,
    min_ticks: u64,
) -> MinimizedTrace
where F: Fn(u64) -> bool,
Expand description

Minimize the tick duration needed to reproduce a failure.

Binary searches on the tick count to find the minimum number of ticks that still triggers the invariant violation.

  • reproduce_fn: (ticks) -> bool — returns true if the failure reproduces at the given tick count.
  • max_ticks: upper bound (must reproduce at this count).
  • min_ticks: lower bound for the search (default: 1).
use vortex_trace::minimize::minimize_ticks;

// Example: find minimum ticks for a bug that appears after tick 750
let result = minimize_ticks(|ticks| ticks >= 750, 2000, 1);
assert!(result.minimized_ticks >= 750);
assert!(result.minimized_ticks < 800); // Binary search precision