mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
bench: make "print_results" a function instead of a macro
This commit is contained in:
parent
2d01a34ff7
commit
b40d205ccd
1 changed files with 17 additions and 15 deletions
|
|
@ -34,19 +34,21 @@ use common::*;
|
|||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
|
||||
macro_rules! print_results {
|
||||
($request_type:expr, $num_rounds:expr, $data:expr) => {
|
||||
let per_second = (
|
||||
($data.0 / ($num_rounds as f64)
|
||||
) as usize).to_formatted_string(&Locale::se);
|
||||
fn print_results(
|
||||
request_type: &str,
|
||||
num_rounds: u64,
|
||||
data: (f64, f64)
|
||||
) {
|
||||
let per_second = (
|
||||
(data.0 / (num_rounds as f64)
|
||||
) as usize).to_formatted_string(&Locale::se);
|
||||
|
||||
println!(
|
||||
"{} {:>10} requests/second, {:>8.2} ns/request",
|
||||
$request_type,
|
||||
per_second,
|
||||
$data.1 / ($num_rounds as f64)
|
||||
);
|
||||
};
|
||||
println!(
|
||||
"{} {:>10} requests/second, {:>8.2} ns/request",
|
||||
request_type,
|
||||
per_second,
|
||||
data.1 / (num_rounds as f64)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -210,9 +212,9 @@ fn main(){
|
|||
|
||||
println!("\n## Average results over {} rounds\n", num_rounds);
|
||||
|
||||
print_results!("Connect handler: ", num_rounds, connect_data);
|
||||
print_results!("Announce handler:", num_rounds, announce_data);
|
||||
print_results!("Scrape handler: ", num_rounds, scrape_data);
|
||||
print_results("Connect handler: ", num_rounds, connect_data);
|
||||
print_results("Announce handler:", num_rounds, announce_data);
|
||||
print_results("Scrape handler: ", num_rounds, scrape_data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue