1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::generate_traffic;
use forge::{NetworkContext, NetworkTest, Result, Test};
use tokio::time::Duration;
pub struct PerformanceBenchmark;
impl Test for PerformanceBenchmark {
fn name(&self) -> &'static str {
"performance::performance-benchmark"
}
}
impl NetworkTest for PerformanceBenchmark {
fn run<'t>(&self, ctx: &mut NetworkContext<'t>) -> Result<()> {
let duration = Duration::from_secs(240);
let all_validators = ctx
.swarm()
.validators()
.map(|v| v.peer_id())
.collect::<Vec<_>>();
let txn_stat = generate_traffic(ctx, &all_validators, duration)?;
ctx.report
.report_txn_stats(self.name().to_string(), txn_stat, duration);
Ok(())
}
}