Browse Source

Do a batch_send every time through the iterations loop, not just once at the top

Also time batch_send and batch_fetch separately, as well as the total
Ian Goldberg 11 months ago
parent
commit
d11e4fc5a6
1 changed files with 16 additions and 11 deletions
  1. 16 11
      sparta/src/main.rs

+ 16 - 11
sparta/src/main.rs

@@ -39,18 +39,22 @@ fn main() {
     let args = Args::parse();
 
     let mut l = LoadBalancer::new(args.users as i64, args.threads, args.maps);
-    let sends: Vec<Record> = (0..args.sends)
-        .map(|x| Record::send(0 as i64, x.try_into().unwrap()))
-        .collect();
-
-    l.batch_send(sends);
-
-    let results: Vec<f64> = (0..(args.runs + args.warmup_runs))
-        .map(|_| {
+    let results: Vec<(usize, usize, f64, f64, f64)> = (0..(args.runs + args.warmup_runs))
+        .map(|iter_num| {
             let start = std::time::SystemTime::now()
                 .duration_since(UNIX_EPOCH)
                 .unwrap()
                 .as_secs_f64();
+            let sends: Vec<Record> = (0..args.sends)
+                .map(|x| Record::send(0 as i64, x.try_into().unwrap()))
+                .collect();
+
+            l.batch_send(sends);
+            let mid = std::time::SystemTime::now()
+                .duration_since(UNIX_EPOCH)
+                .unwrap()
+                .as_secs_f64();
+
             let _responses = l.batch_fetch(vec![Record::fetch(0, args.fetches)]);
             let end = std::time::SystemTime::now()
                 .duration_since(UNIX_EPOCH)
@@ -61,13 +65,14 @@ fn main() {
             //     println!("{:?}", response);
             // }
 
-            end - start
+            (iter_num + 1, l.size(), mid - start, end - mid, end - start)
         })
         .collect();
 
-    print!("{}\t", args.sends);
+    println!("#users batches_sent store_size send_time fetch_time total_time");
     for result in results[..].iter() {
-        print!("{}\t", *result);
+        println!("{} {} {} {} {} {}", args.sends, result.0, result.1,
+            result.2, result.3, result.4);
     }
     println!();
 }