浏览代码

Add max number of msgs to send

master
Henry Case 5 年前
父节点
当前提交
e45a7687ea
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. +11
    -0
      rawhammer/src/main.rs

+ 11
- 0
rawhammer/src/main.rs 查看文件

@@ -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);


正在加载...
取消
保存