|
|
@ -108,6 +108,14 @@ impl AppConfig for Config { |
|
|
|
.help("Cycle time (us, append \"s\" or \"ms\" for coarser time)") |
|
|
|
.help("Cycle time (us, append \"s\" or \"ms\" for coarser time)") |
|
|
|
.takes_value(true), |
|
|
|
.takes_value(true), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
.arg( |
|
|
|
|
|
|
|
clap::Arg::with_name("sched") |
|
|
|
|
|
|
|
.long("sched") |
|
|
|
|
|
|
|
.short("S") |
|
|
|
|
|
|
|
.value_name("MILLIS") |
|
|
|
|
|
|
|
.help("Scheduler switch time (ms, append \"u\", \"s\" or \"ms\" for other unit)") |
|
|
|
|
|
|
|
.takes_value(true), |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn configure(mut self, clap: &ArgMatches) -> anyhow::Result<Self> { |
|
|
|
fn configure(mut self, clap: &ArgMatches) -> anyhow::Result<Self> { |
|
|
@ -126,11 +134,28 @@ impl AppConfig for Config { |
|
|
|
} else if t.ends_with("s") { |
|
|
|
} else if t.ends_with("s") { |
|
|
|
(&t[..(t.len()-1)], 1000_000) |
|
|
|
(&t[..(t.len()-1)], 1000_000) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
(t, 1) |
|
|
|
(t, 1) // us default
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
self.cycle_time = Duration::from_micros(t.parse::<u64>().expect("parse -C value") * mul); |
|
|
|
self.cycle_time = Duration::from_micros(t.parse::<u64>().expect("parse -C value") * mul); |
|
|
|
println!("ct = {:?}", self.cycle_time); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(t) = clap.value_of("sched") { |
|
|
|
|
|
|
|
let (t, mul) = if t.ends_with("us") { |
|
|
|
|
|
|
|
(&t[..(t.len()-2)], 1) |
|
|
|
|
|
|
|
} else if t.ends_with("ms") { |
|
|
|
|
|
|
|
(&t[..(t.len()-2)], 1000) |
|
|
|
|
|
|
|
} else if t.ends_with("m") { |
|
|
|
|
|
|
|
(&t[..(t.len()-1)], 1000) |
|
|
|
|
|
|
|
} else if t.ends_with("u") { |
|
|
|
|
|
|
|
(&t[..(t.len()-1)], 1) |
|
|
|
|
|
|
|
} else if t.ends_with("s") { |
|
|
|
|
|
|
|
(&t[..(t.len()-1)], 1000_000) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
(t, 1000) // ms default
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.switch_time = Duration::from_micros(t.parse::<u64>().expect("parse -S value") * mul); |
|
|
|
} |
|
|
|
} |
|
|
|
Ok(self) |
|
|
|
Ok(self) |
|
|
|
} |
|
|
|
} |
|
|
|