rust version: fix calculation of loops/sec and solutions/sec
This commit is contained in:
parent
bc8cf33fd6
commit
198084206b
10
src/main.rs
10
src/main.rs
@ -139,16 +139,20 @@ impl SField {
|
||||
loop_count += 1;
|
||||
const MILLIS_PER_SEC: u128 = 1_000;
|
||||
const UPDATE_DELAY_MS: u128 = 80;
|
||||
if now.elapsed().as_millis() >= UPDATE_DELAY_MS {
|
||||
if loop_count % 1000 == 0 {
|
||||
let elapsed_ms = now.elapsed().as_millis();
|
||||
if elapsed_ms <= UPDATE_DELAY_MS {
|
||||
continue;
|
||||
}
|
||||
self.print_clear();
|
||||
self.print();
|
||||
println!(
|
||||
"{} loops/sec",
|
||||
(loop_count - last_loop_count) * (MILLIS_PER_SEC / UPDATE_DELAY_MS)
|
||||
(loop_count - last_loop_count) * (MILLIS_PER_SEC / elapsed_ms)
|
||||
);
|
||||
println!(
|
||||
"{} solutions/sec",
|
||||
(num_solutions - last_num_solutions) * (MILLIS_PER_SEC / UPDATE_DELAY_MS)
|
||||
(num_solutions - last_num_solutions) * (MILLIS_PER_SEC / elapsed_ms)
|
||||
);
|
||||
last_loop_count = loop_count;
|
||||
last_num_solutions = num_solutions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user