mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +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;
|
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
|
|
||||||
macro_rules! print_results {
|
fn print_results(
|
||||||
($request_type:expr, $num_rounds:expr, $data:expr) => {
|
request_type: &str,
|
||||||
let per_second = (
|
num_rounds: u64,
|
||||||
($data.0 / ($num_rounds as f64)
|
data: (f64, f64)
|
||||||
) as usize).to_formatted_string(&Locale::se);
|
) {
|
||||||
|
let per_second = (
|
||||||
|
(data.0 / (num_rounds as f64)
|
||||||
|
) as usize).to_formatted_string(&Locale::se);
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"{} {:>10} requests/second, {:>8.2} ns/request",
|
"{} {:>10} requests/second, {:>8.2} ns/request",
|
||||||
$request_type,
|
request_type,
|
||||||
per_second,
|
per_second,
|
||||||
$data.1 / ($num_rounds as f64)
|
data.1 / (num_rounds as f64)
|
||||||
);
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -210,9 +212,9 @@ fn main(){
|
||||||
|
|
||||||
println!("\n## Average results over {} rounds\n", num_rounds);
|
println!("\n## Average results over {} rounds\n", num_rounds);
|
||||||
|
|
||||||
print_results!("Connect handler: ", num_rounds, connect_data);
|
print_results("Connect handler: ", num_rounds, connect_data);
|
||||||
print_results!("Announce handler:", num_rounds, announce_data);
|
print_results("Announce handler:", num_rounds, announce_data);
|
||||||
print_results!("Scrape handler: ", num_rounds, scrape_data);
|
print_results("Scrape handler: ", num_rounds, scrape_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue