Explorar el Código

Add max number of msgs to send

master
Henry Case hace 5 años
padre
commit
e45a7687ea
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. +11
    -0
      rawhammer/src/main.rs

+ 11
- 0
rawhammer/src/main.rs Ver fichero

@@ -240,6 +240,12 @@ fn main() -> std::io::Result<()> {
.takes_value(true)
.required(false)
.help("Number of sending threads (default 1)"))
.arg(Arg::with_name("maxmsg")
.short("m")
.long("max_messages")
.takes_value(true)
.required(false)
.help("Max number of messages to send (default infinity)"))
.get_matches();

let sock_addr: SocketAddr = matches
@@ -255,6 +261,8 @@ fn main() -> std::io::Result<()> {
.value_of("case").unwrap().parse().unwrap();
let sending_threads: usize = matches
.value_of("threads").unwrap_or("1").parse().unwrap();
let max_msg: usize = matches
.value_of("maxmsg").unwrap_or("0").parse().unwrap();

println!("Sending to {0}, with freq {1} per sec on {2} threads.",
sock_addr, msg_per_sec, sending_threads);
@@ -297,6 +305,9 @@ fn main() -> std::io::Result<()> {
((msg_nb_report as f64 / now.elapsed().as_millis() as f64) * 1000 as f64) as i64);
now = Instant::now();
}
if max_msg!=0 && max_msg <= ch_sent {
break;
}
}
});
threads.push(t);


Cargando…
Cancelar
Guardar