Enable the number of runs to be customized

next
Sayan Nandan 3 years ago
parent 0843552dcb
commit 8f4b6b9e5c

@ -37,8 +37,6 @@ use std::net::TcpStream;
/// Just a sweet `*1\n` /// Just a sweet `*1\n`
const SIMPLE_QUERY_SIZE: usize = 3; const SIMPLE_QUERY_SIZE: usize = 3;
const DEFAULT_REPEAT: usize = 5;
/// For a dataframe, this returns the dataframe size for array responses. /// For a dataframe, this returns the dataframe size for array responses.
/// ///
/// For example, /// For example,
@ -118,6 +116,7 @@ pub fn runner(
max_queries: usize, max_queries: usize,
per_kv_size: usize, per_kv_size: usize,
json_out: bool, json_out: bool,
runs: usize,
) { ) {
if !json_out { if !json_out {
println!("Running sanity test ..."); println!("Running sanity test ...");
@ -205,8 +204,8 @@ pub fn runner(
println!("Per-packet size (UPDATE): {} bytes", update_packs[0].len()); println!("Per-packet size (UPDATE): {} bytes", update_packs[0].len());
println!("Initialization complete! Benchmark started"); println!("Initialization complete! Benchmark started");
} }
let mut report = report::AggregatedReport::new(3, DEFAULT_REPEAT, max_queries); let mut report = report::AggregatedReport::new(3, runs, max_queries);
for i in 0..DEFAULT_REPEAT { for i in 1..runs + 1 {
let mut dt = DevTime::new_complex(); let mut dt = DevTime::new_complex();
// clone in the keys // clone in the keys
let set_packs = set_packs.clone(); let set_packs = set_packs.clone();
@ -244,7 +243,7 @@ pub fn runner(
dt.stop_timer("UPDATE").unwrap(); dt.stop_timer("UPDATE").unwrap();
if !json_out { if !json_out {
println!("Finished run: {}", i + 1); println!("Finished run: {}", i);
} }
// drop table // drop table

@ -63,6 +63,13 @@ args:
value_name: port value_name: port
help: Sets the remote port to connect to help: Sets the remote port to connect to
takes_value: true takes_value: true
- runs:
short: r
required: false
long: runs
value_name: runs
takes_value: true
help: Sets the number of times the entire test should be run
subcommands: subcommands:
- testkey: - testkey:
about: This can be used to create 'mock' keys about: This can be used to create 'mock' keys

@ -38,6 +38,7 @@ mod report;
mod testkey; mod testkey;
use crate::util::DEFAULT_PACKET_SIZE; use crate::util::DEFAULT_PACKET_SIZE;
use crate::util::DEFAULT_QUERY_COUNT; use crate::util::DEFAULT_QUERY_COUNT;
use crate::util::DEFAULT_REPEAT;
use crate::util::DEFAULT_WORKER_COUNT; use crate::util::DEFAULT_WORKER_COUNT;
// external imports // external imports
use clap::{load_yaml, App}; use clap::{load_yaml, App};
@ -73,6 +74,11 @@ fn main() {
None => DEFAULT_PACKET_SIZE, None => DEFAULT_PACKET_SIZE,
_ => err!("Bad value for key/value size"), _ => err!("Bad value for key/value size"),
}; };
let runs: usize = match matches.value_of("runs").map(|v| v.parse()) {
Some(Ok(r)) => r,
Some(Err(_)) => err!("Bad value for runs"),
None => DEFAULT_REPEAT,
};
if packet_size == 0 || max_queries == 0 || max_connections == 0 { if packet_size == 0 || max_queries == 0 || max_connections == 0 {
err!("All inputs must be non-zero values"); err!("All inputs must be non-zero values");
} }
@ -98,6 +104,7 @@ fn main() {
max_queries, max_queries,
packet_size, packet_size,
json_out, json_out,
runs,
); );
} }
} }

@ -31,6 +31,7 @@ use std::error::Error;
pub const DEFAULT_WORKER_COUNT: usize = 10; pub const DEFAULT_WORKER_COUNT: usize = 10;
pub const DEFAULT_PACKET_SIZE: usize = 8; pub const DEFAULT_PACKET_SIZE: usize = 8;
pub const DEFAULT_QUERY_COUNT: usize = 100_000; pub const DEFAULT_QUERY_COUNT: usize = 100_000;
pub const DEFAULT_REPEAT: usize = 10;
#[macro_export] #[macro_export]
macro_rules! hoststr { macro_rules! hoststr {

Loading…
Cancel
Save