1use dive_eval::{Counter, RunConfig};
5use dive_stdlib::host::RunHost;
6
7use crate::CheckOptions;
8
9#[must_use]
14pub fn run_config(opts: &CheckOptions, deadlock: bool) -> RunConfig {
15 #[allow(clippy::cast_possible_wrap, reason = "Java's long: same bits")]
16 let fingerprint = dive_value::fp64::POLYS
17 .get(opts.fp_index)
18 .copied()
19 .unwrap_or(0) as i64;
20 RunConfig {
21 deadlock,
22 workers: match opts.profile {
23 dive_eval::Profile::Tlc => i64::try_from(opts.workers).unwrap_or(i64::MAX),
24 dive_eval::Profile::Dive => 1,
25 },
26 seed: opts.seed,
27 fingerprint,
28 install: std::env::current_exe()
29 .map(|p| p.display().to_string())
30 .unwrap_or_default(),
31 }
32}
33
34pub fn startup_counters(host: &RunHost) {
37 for c in [
38 Counter::Generated,
39 Counter::Distinct,
40 Counter::Queue,
41 Counter::Initial,
42 ] {
43 host.set_counter(c, Some(0));
44 }
45 host.set_counter(Counter::Diameter, Some(1));
46}
47
48pub fn search_counters(host: &RunHost) {
52 for c in [
53 Counter::Generated,
54 Counter::Distinct,
55 Counter::Queue,
56 Counter::Initial,
57 Counter::Diameter,
58 Counter::DurationSecs,
59 ] {
60 host.set_counter(c, None);
61 }
62}