summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-transport/benches/transfer.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/rust/neqo-transport/benches/transfer.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/third_party/rust/neqo-transport/benches/transfer.rs b/third_party/rust/neqo-transport/benches/transfer.rs
index 444f738f9c..32959f6cb5 100644
--- a/third_party/rust/neqo-transport/benches/transfer.rs
+++ b/third_party/rust/neqo-transport/benches/transfer.rs
@@ -6,7 +6,7 @@
use std::time::Duration;
-use criterion::{criterion_group, criterion_main, BatchSize::SmallInput, Criterion};
+use criterion::{criterion_group, criterion_main, BatchSize::SmallInput, Criterion, Throughput};
use test_fixture::{
boxed,
sim::{
@@ -20,8 +20,11 @@ const ZERO: Duration = Duration::from_millis(0);
const JITTER: Duration = Duration::from_millis(10);
const TRANSFER_AMOUNT: usize = 1 << 22; // 4Mbyte
-fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<impl AsRef<str>>) {
- c.bench_function(label, |b| {
+fn benchmark_transfer(c: &mut Criterion, label: &str, seed: &Option<impl AsRef<str>>) {
+ let mut group = c.benchmark_group("transfer");
+ group.throughput(Throughput::Bytes(u64::try_from(TRANSFER_AMOUNT).unwrap()));
+ group.noise_threshold(0.03);
+ group.bench_function(label, |b| {
b.iter_batched(
|| {
let nodes = boxed![
@@ -42,15 +45,16 @@ fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<impl AsRef<st
sim.run();
},
SmallInput,
- )
+ );
});
+ group.finish();
}
fn benchmark_transfer_variable(c: &mut Criterion) {
benchmark_transfer(
c,
"Run multiple transfers with varying seeds",
- std::env::var("SIMULATION_SEED").ok(),
+ &std::env::var("SIMULATION_SEED").ok(),
);
}
@@ -58,7 +62,7 @@ fn benchmark_transfer_fixed(c: &mut Criterion) {
benchmark_transfer(
c,
"Run multiple transfers with the same seed",
- Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
+ &Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
);
}