Skip to content

Commit

Permalink
Changed name to tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
emilpriver committed Sep 17, 2023
1 parent 873b8c9 commit 99e50c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ pub struct Result {
*/
pub async fn run_benchmark(test: routes::CreateTest) -> Vec<Result> {
log::info!(
"Starting benchmark using {} threads with {} connections for {} seconds",
test.threads,
test.connections,
"Starting benchmark using {} tasks for {} seconds",
test.tasks,
test.seconds
);

let mut results: Vec<Result> = vec![];
let (tx, mut rx) = mpsc::channel(test.connections as usize);
let (tx, mut rx) = mpsc::channel(test.tasks as usize);

for thread in 0..test.threads {
for thread in 0..test.tasks {
let tx_clone = tx.clone();
let cloned_test = test.clone();

Expand Down Expand Up @@ -116,7 +115,7 @@ pub async fn run_benchmark(test: routes::CreateTest) -> Vec<Result> {
while let Some(i) = rx.recv().await {
results.push(i);

if results.len() >= (test.threads * test.seconds) as usize {
if results.len() >= (test.tasks * test.seconds) as usize {
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ pub enum HttpMethods {
#[derive(Deserialize, Serialize, Clone)]
pub struct CreateTest {
pub method: HttpMethods,
pub connections: u64,
pub threads: u64,
pub tasks: u64,
pub seconds: u64,
pub start_at: String,
pub url: String,
Expand Down

0 comments on commit 99e50c6

Please sign in to comment.