load tester: refactor, add udp sets, improve docs, add command options

This commit is contained in:
Joakim Frostegård 2023-12-27 21:22:58 +01:00
parent 7b6bb12c9e
commit 0317053f80
6 changed files with 354 additions and 196 deletions

View file

@ -4,16 +4,28 @@ pub mod run;
pub mod set;
use clap::{Parser, Subcommand};
use common::CpuMode;
#[derive(Parser)]
#[command(author, version, about)]
struct Args {
/// How to choose which virtual CPUs to allow trackers and load test
/// executables on
#[arg(long, default_value_t = CpuMode::Split)]
cpu_mode: CpuMode,
/// Minimum number of tracker cpu cores to run load tests for
#[arg(long)]
min_cores: Option<usize>,
/// Maximum number of tracker cpu cores to run load tests for
#[arg(long)]
max_cores: Option<usize>,
#[command(subcommand)]
command: Command,
}
#[derive(Subcommand)]
enum Command {
/// Benchmark UDP BitTorrent trackers aquatic_udp and opentracker
#[cfg(feature = "udp")]
Udp(protocols::udp::UdpCommand),
}
@ -23,6 +35,8 @@ fn main() {
match args.command {
#[cfg(feature = "udp")]
Command::Udp(command) => command.run().unwrap(),
Command::Udp(command) => command
.run(args.cpu_mode, args.min_cores, args.max_cores)
.unwrap(),
}
}