Skip to content

Commit

Permalink
Better time measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacarte committed Aug 24, 2023
1 parent 51d5608 commit c84b9d6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions host_based/stacking/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,23 +514,28 @@ fn main() -> Result<(), anyhow::Error> {
std::fs::write(format!("{}.{}.{}.chaos.cwasm", opts.output.to_str().unwrap(), hash2, hash), serialized).unwrap();

if let Some(oracle) = &opsclone.oracle {
// Pause the timer to skip oracle time
let elapsed = now.elapsed();
if call_oracle(oracle.clone(), format!("{}.{}.{}.chaos.cwasm", opts.output.to_str().unwrap(), hash2, hash)) {
// The oracle returned 1, we stop
let elapsed = now.elapsed();
eprintln!("Elapsed time until oracle: {}s", elapsed.as_millis());
eprintln!("Oracle returned 1, we stop");
std::process::exit(0);
}
// Resume the timer
let elapsed = now.elapsed();
}
} else {
if let Some(oracle) = &opsclone.oracle {
let elapsed = now.elapsed();

if call_oracle(oracle.clone(), format!("{}.{}.{}.chaos.wasm", opts.output.to_str().unwrap(), hash2, hash)) {
// The oracle returned 1, we stop
let elapsed = now.elapsed();
eprintln!("Elapsed time until oracle: {}s", elapsed.as_millis());
eprintln!("Oracle returned 1, we stop");
std::process::exit(0);
}
let elapsed = now.elapsed();

}
}

Expand Down

0 comments on commit c84b9d6

Please sign in to comment.