mirror of
https://github.com/0xShay/rust-orderbook.git
synced 2026-01-11 13:13:24 +00:00
add execution time logs
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -1,6 +1,7 @@
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::str::SplitWhitespace;
|
use std::str::SplitWhitespace;
|
||||||
|
use std::time::SystemTime;
|
||||||
|
|
||||||
struct Orderbook {
|
struct Orderbook {
|
||||||
// both of these maps map a price to a quantity
|
// both of these maps map a price to a quantity
|
||||||
@@ -289,6 +290,8 @@ fn main() {
|
|||||||
io::stdin().read_line(&mut input_string).unwrap();
|
io::stdin().read_line(&mut input_string).unwrap();
|
||||||
println!();
|
println!();
|
||||||
|
|
||||||
|
let start_time = SystemTime::now();
|
||||||
|
|
||||||
let mut split = input_string.split_whitespace();
|
let mut split = input_string.split_whitespace();
|
||||||
|
|
||||||
let command: Option<&str> = split.next();
|
let command: Option<&str> = split.next();
|
||||||
@@ -324,10 +327,15 @@ fn main() {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Unknown command.");
|
println!("Unknown command.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let end_time = SystemTime::now();
|
||||||
|
let difference = end_time.duration_since(start_time).unwrap();
|
||||||
|
println!();
|
||||||
|
println!("Executed in {}μs", difference.as_micros());
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
list_orders(&ob);
|
list_orders(&ob);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user