| 
														
															@@ -1,4 +1,4 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-use std::{path::{Path, PathBuf}, fs::{File, self, OpenOptions}, io::{BufWriter, Write, self, Read, BufRead}, net::Ipv4Addr, process::{Command, self, Stdio}, time::{Instant, Duration}, thread::{self, sleep}}; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+use std::{path::{Path, PathBuf}, fs::{File, self, OpenOptions}, io::{BufWriter, Write, self, Read, BufRead}, net::Ipv4Addr, process::{Command, self, Stdio}, time::{Instant, Duration}, thread}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use json::JsonValue; 
														 | 
														
														 | 
														
															 use json::JsonValue; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use log::info; 
														 | 
														
														 | 
														
															 use log::info; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use rand::prelude::*; 
														 | 
														
														 | 
														
															 use rand::prelude::*; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -9,6 +9,7 @@ mod error; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 pub use crate::run::args::*; 
														 | 
														
														 | 
														
															 pub use crate::run::args::*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 pub use crate::run::error::*; 
														 | 
														
														 | 
														
															 pub use crate::run::error::*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 pub use crate::run::args::TestType::*; 
														 | 
														
														 | 
														
															 pub use crate::run::args::TestType::*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+pub use crate::run::args::FilterType::*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 pub const BENCH_BASE_PATH: &str = "./bench"; 
														 | 
														
														 | 
														
															 pub const BENCH_BASE_PATH: &str = "./bench"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 pub const BENCH_DATA_PATH: &str = "data"; 
														 | 
														
														 | 
														
															 pub const BENCH_DATA_PATH: &str = "data"; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -56,16 +57,17 @@ pub fn run() -> Result<(), anyhow::Error> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let cores: u32 = 4; 
														 | 
														
														 | 
														
															     let cores: u32 = 4; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let seed: u64 = 0x1337133713371337; 
														 | 
														
														 | 
														
															     let seed: u64 = 0x1337133713371337; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    // let scan_sizes: Vec<u64> = vec![8, 16];//, 24];//,32]; // TODO 8 only for test purposes 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let scan_sizes: Vec<u64> = vec![24]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let scan_sizes: Vec<u64> = vec![8, 16];//, 24];//,32]; // TODO 8 only for test purposes 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    // let scan_sizes: Vec<u64> = vec![24]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // let hit_rates: Vec<f64> = vec![0.001, 0.0032,0.01,0.032,0.1]; 
														 | 
														
														 | 
														
															     // let hit_rates: Vec<f64> = vec![0.001, 0.0032,0.01,0.032,0.1]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let hit_rates: Vec<f64> = vec![0.02]; 
														 | 
														
														 | 
														
															     let hit_rates: Vec<f64> = vec![0.02]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // let false_positive_rates: Vec<TestType> = vec![Baseline, EmptyFilter,Normal(0.1),Normal(0.01),Normal(0.001),Normal(0.0001)]; 
														 | 
														
														 | 
														
															     // let false_positive_rates: Vec<TestType> = vec![Baseline, EmptyFilter,Normal(0.1),Normal(0.01),Normal(0.001),Normal(0.0001)]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let false_positive_rates: Vec<TestType> = vec![Baseline, Normal(0.001), BpfStats(0.001)]; 
														 | 
														
														 | 
														
															     let false_positive_rates: Vec<TestType> = vec![Baseline, Normal(0.001), BpfStats(0.001)]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let filter_types: Vec<FilterType> = vec![Bitmap, Bloom]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let baseline_filter_types: Vec<FilterType> = vec![Bitmap]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // let scan_rates: Vec<u64> = vec![316_000, 562_000, 1_000_000, 1_780_000, 3_160_000]; 
														 | 
														
														 | 
														
															     // let scan_rates: Vec<u64> = vec![316_000, 562_000, 1_000_000, 1_780_000, 3_160_000]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let scan_rates: Vec<u64> = vec![300000, 377678, 475468, 598579, 753566, 948683, 1194322, 1503562, 1892872, 2382985, 3000000]; 
														 | 
														
														 | 
														
															     let scan_rates: Vec<u64> = vec![300000, 377678, 475468, 598579, 753566, 948683, 1194322, 1503562, 1892872, 2382985, 3000000]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    // baseline test against dummy interface (drop all) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     for scan_size in &scan_sizes { 
														 | 
														
														 | 
														
															     for scan_size in &scan_sizes { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for hit_rate in &hit_rates { 
														 | 
														
														 | 
														
															         for hit_rate in &hit_rates { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -82,126 +84,137 @@ pub fn run() -> Result<(), anyhow::Error> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             info!("subnet for {} is {}", data_args, subnet); 
														 | 
														
														 | 
														
															             info!("subnet for {} is {}", data_args, subnet); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             for test_type in &false_positive_rates { 
														 | 
														
														 | 
														
															             for test_type in &false_positive_rates { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                let bloom_args = BloomFilterArgs::from(data_args, *test_type); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                info!("Building binaries for {} {}", data_args, bloom_args); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                build_binaries(data_args, bloom_args) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    .context(format!("Failed to build binaries for {} {}", data_args, bloom_args))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                let filter_path = match test_type { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    Normal(_) | EmptyFilter | BpfStats(_) => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        info!("Building filter for {} {}", data_args, bloom_args); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        let filter_path = build_filter(data_args, bloom_args, ip_file_path.as_path()) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .context(format!("Failed to build filter for {} {}", data_args, bloom_args))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        Some(filter_path) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                let filter_types = match test_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    Normal(_) | BpfStats(_) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        &filter_types 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     }, 
														 | 
														
														 | 
														
															                     }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     Baseline => { 
														 | 
														
														 | 
														
															                     Baseline => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        None 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        &baseline_filter_types 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     } 
														 | 
														
														 | 
														
															                     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 }; 
														 | 
														
														 | 
														
															                 }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                for scan_rate in &scan_rates { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    let scan_args = ScanArgs::new(*scan_rate); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    let args = BenchArgs {data_args, bloom_filter_args: bloom_args, scan_args}; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    let run_output = (|| { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        fs::create_dir_all(args.wd_path()) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .context("Failed to create wd") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .map_err(|e| (None, e))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        let (handle, stderr_handle, stdout_handle)  = match test_type { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            Normal(_) | EmptyFilter | BpfStats(_) => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                info!("Loading XDP program for {}", args); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                let (handle, stderr_handle, stdout_handle) = load_xdp(args, Some(filter_path.clone().unwrap().as_path())) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    .map_err(|(h, e)| (h, e.context(format!("Loading XDP program for {}", args))))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                (Some(handle), Some(stderr_handle), Some(stdout_handle)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            }, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            Baseline => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                info!("Not loading XDP program for {}", args); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                (None, None, None) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        }; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if let BpfStats(_) = test_type { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            info!("Enabling bpf_stats"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            if let Err(e) = set_bpf_stats(args, true) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                return Err((handle, e)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                for filter_type in filter_types { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    let bloom_args = FilterArgs::from(data_args, *test_type, *filter_type); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    info!("Building binaries for {} {}", data_args, bloom_args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    build_binaries(data_args, bloom_args) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        .context(format!("Failed to build binaries for {} {}", data_args, bloom_args))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    let filter_path = match test_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        Normal(_) | BpfStats(_) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            info!("Building filter for {} {}", data_args, bloom_args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            let filter_path = build_filter(data_args, bloom_args, *filter_type, ip_file_path.as_path()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .context(format!("Failed to build filter for {} {}", data_args, bloom_args))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            Some(filter_path) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        Baseline => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            None 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                         } 
														 | 
														
														 | 
														
															                         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        info!("Running zmap for {}", args); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        let zmap_result = run_zmap(args, subnet) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .context(format!("Running zmap for {}", args)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if let Err(e) = zmap_result { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            return Err((handle, e)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        let zmap_output = zmap_result.unwrap(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        let bpf_stats = match test_type { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            BpfStats(_) => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                info!("Disabling and collecting bpf_stats"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                if let Err(e) = set_bpf_stats(args, false) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    return Err((handle, e)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    for scan_rate in &scan_rates { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        let scan_args = ScanArgs::new(*scan_rate); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        let args = BenchArgs {data_args, bloom_filter_args: bloom_args, scan_args}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        let run_output = (|| { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            fs::create_dir_all(args.wd_path()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .context("Failed to create wd") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .map_err(|e| (None, e))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            let (handle, stderr_handle, stdout_handle)  = match test_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                Normal(_) | BpfStats(_) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    info!("Loading XDP program for {}", args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    let (handle, stderr_handle, stdout_handle) = load_xdp(args, filter_path.clone().unwrap().as_path()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        .map_err(|(h, e)| (h, e.context(format!("Loading XDP program for {}", args))))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    (Some(handle), Some(stderr_handle), Some(stdout_handle)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                Baseline => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    info!("Not loading XDP program for {}", args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    (None, None, None) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                                 } 
														 | 
														
														 | 
														
															                                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                let bpf_stats_result = read_bpf_stats(args) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    .context(format!("Failed to read bpf stats for {}", args)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                if let Err(e) = bpf_stats_result { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            if let BpfStats(_) = test_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                info!("Enabling bpf_stats"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                if let Err(e) = set_bpf_stats(args, true) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                                     return Err((handle, e)); 
														 | 
														
														 | 
														
															                                     return Err((handle, e)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                                 } 
														 | 
														
														 | 
														
															                                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                let bpf_stats = bpf_stats_result.unwrap(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                Some(bpf_stats) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            _ => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                None 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        }; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        let responder_output = match test_type { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            BpfStats(_) | Normal(_) | EmptyFilter => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                info!("Telling 'responder' to unload XDP"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                let responder_output = unload_xdp(args, handle.unwrap()) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    .map_err(|(h, e)| (h, e.context(format!("Could not successfully unload XDP program for {}", args))))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                Some(responder_output) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                             } 
														 | 
														
														 | 
														
															                             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            Baseline => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                None 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            info!("Running zmap for {}", args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            let zmap_result = run_zmap(args, subnet) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .context(format!("Running zmap for {}", args)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            if let Err(e) = zmap_result { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                return Err((handle, e)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                             } 
														 | 
														
														 | 
														
															                             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        }; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        Ok((zmap_output, responder_output, bpf_stats, stderr_handle, stdout_handle)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    })(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    let (zmap_output, _responder_output, bpf_stats, responder_stderr_handle, responder_stdout_handle) = run_output.map_err(|(handle, e)| { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if let Some(mut handle) = handle { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            let kill_result = handle.kill(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            if let Err(kill_e) = kill_result { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                return anyhow!(kill_e) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    .context(e) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    .context(format!("Failed to kill responder process for {}; Killed because of reason below", args)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            let zmap_output = zmap_result.unwrap(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            let bpf_stats = match test_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                BpfStats(_) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    info!("Disabling and collecting bpf_stats"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    if let Err(e) = set_bpf_stats(args, false) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        return Err((handle, e)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    let bpf_stats_result = read_bpf_stats(args) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        .context(format!("Failed to read bpf stats for {}", args)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    if let Err(e) = bpf_stats_result { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        return Err((handle, e)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    let bpf_stats = bpf_stats_result.unwrap(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    Some(bpf_stats) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                _ => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    None 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            let responder_output = match test_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                BpfStats(_) | Normal(_) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    info!("Telling 'responder' to unload XDP"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    let responder_output = unload_xdp(args, handle.unwrap()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        .map_err(|(h, e)| (h, e.context(format!("Could not successfully unload XDP program for {}", args))))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    Some(responder_output) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                Baseline => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    None 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            Ok((zmap_output, responder_output, bpf_stats, stderr_handle, stdout_handle)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        })(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        let (zmap_output, _responder_output, bpf_stats, responder_stderr_handle, responder_stdout_handle) = run_output.map_err(|(handle, e)| { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            if let Some(mut handle) = handle { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                let kill_result = handle.kill(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                if let Err(kill_e) = kill_result { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                    return anyhow!(kill_e) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        .context(e) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                        .context(format!("Failed to kill responder process for {}; Killed because of reason below", args)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                             } 
														 | 
														
														 | 
														
															                             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            e 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        })?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        if let Some(responder_stderr_handle) = responder_stderr_handle { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            responder_stderr_handle.join() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                                   .map_err(|_| anyhow!("stderr thread panicked")) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                                   .and(responder_stdout_handle.unwrap().join() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                                        .map_err(|_| anyhow!("stdout thread panicked"))) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                                   .and_then(|res| res) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                                   .context(format!("Error occured in a log thread for {}", args))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                         } 
														 | 
														
														 | 
														
															                         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        e 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    })?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    if let Some(responder_stderr_handle) = responder_stderr_handle { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        responder_stderr_handle.join() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                               .map_err(|_| anyhow!("stderr thread panicked")) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                               .and(responder_stdout_handle.unwrap().join() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                                    .map_err(|_| anyhow!("stdout thread panicked"))) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                               .and_then(|res| res) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                               .context(format!("Error occured in a log thread for {}", args))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    File::create(args.wd_path().join("zmap_stats.txt")) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        .context(format!("Failed to create zmap_stats.txt file for {}", args))? 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        .write_all(&zmap_output.stderr.as_slice()) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        .context(format!("Failed to write to zmap_stats.txt file for {}", args))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    if let Some(bpf_stats) = bpf_stats { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        File::create(args.wd_path().join("bpf_stats.json")) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .context(format!("Failed to create bpf_stats.json file for {}", args))? 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .write_all(format!("{{\"run_count\": {}, \"run_time\": {}, \"mem_lock\": {}}}", bpf_stats.0, bpf_stats.1, bpf_stats.2).as_bytes()) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            .context(format!("Failed to write to bpf_stats.json file for {}", args))?; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        File::create(args.wd_path().join("zmap_stats.txt")) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            .context(format!("Failed to create zmap_stats.txt file for {}", args))? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            .write_all(&zmap_output.stderr.as_slice()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            .context(format!("Failed to write to zmap_stats.txt file for {}", args))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        if let Some(bpf_stats) = bpf_stats { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                            File::create(args.wd_path().join("bpf_stats.json")) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .context(format!("Failed to create bpf_stats.json file for {}", args))? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .write_all(format!("{{\"run_count\": {}, \"run_time\": {}, \"mem_lock\": {}}}", bpf_stats.0, bpf_stats.1, bpf_stats.2).as_bytes()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                .context(format!("Failed to write to bpf_stats.json file for {}", args))?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     } 
														 | 
														
														 | 
														
															                     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -256,7 +269,7 @@ fn build_ip_file(data_args: DataArgs) -> anyhow::Result<(PathBuf, Ipv4Addr)> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     Ok((path, Ipv4Addr::from(subnet))) 
														 | 
														
														 | 
														
															     Ok((path, Ipv4Addr::from(subnet))) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-fn build_binaries(data_args: DataArgs, bloom_args: BloomFilterArgs) -> anyhow::Result<()> { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+fn build_binaries(data_args: DataArgs, bloom_args: FilterArgs) -> anyhow::Result<()> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let bin_path = BenchArgs::bin_bin_path(data_args, bloom_args); 
														 | 
														
														 | 
														
															     let bin_path = BenchArgs::bin_bin_path(data_args, bloom_args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     fs::create_dir_all(&bin_path).context("Failed to create bench dir")?; 
														 | 
														
														 | 
														
															     fs::create_dir_all(&bin_path).context("Failed to create bench dir")?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let output = Command::new("cargo") 
														 | 
														
														 | 
														
															     let output = Command::new("cargo") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -267,7 +280,7 @@ fn build_binaries(data_args: DataArgs, bloom_args: BloomFilterArgs) -> anyhow::R 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         ]) 
														 | 
														
														 | 
														
															         ]) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .env("BLOOMFILTER_ADDRESS_BITS", bloom_args.address_bits.to_string()) 
														 | 
														
														 | 
														
															         .env("BLOOMFILTER_ADDRESS_BITS", bloom_args.address_bits.to_string()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .env("BLOOMFILTER_ADDRESS_BITS_CHUNK", bloom_args.chunk_address_bits.to_string()) 
														 | 
														
														 | 
														
															         .env("BLOOMFILTER_ADDRESS_BITS_CHUNK", bloom_args.chunk_address_bits.to_string()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        .env("BLOOMFILTER_HASH_COUNT", bloom_args.hash_count.to_string()) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        .env("BLOOMFILTER_HASH_COUNT", bloom_args.hash_count.unwrap_or(0).to_string()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .stdin(Stdio::null()) 
														 | 
														
														 | 
														
															         .stdin(Stdio::null()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .stderr(Stdio::piped()) 
														 | 
														
														 | 
														
															         .stderr(Stdio::piped()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .stdout(Stdio::null()) 
														 | 
														
														 | 
														
															         .stdout(Stdio::null()) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -281,10 +294,17 @@ fn build_binaries(data_args: DataArgs, bloom_args: BloomFilterArgs) -> anyhow::R 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     Ok(()) 
														 | 
														
														 | 
														
															     Ok(()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-fn build_filter(data_args: DataArgs, bloom_args: BloomFilterArgs, ip_file_path: &Path) -> anyhow::Result<PathBuf> { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let path = BenchArgs::bin_wd_path(data_args, bloom_args).join("ips.bfb"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+fn build_filter(data_args: DataArgs, bloom_args: FilterArgs, filter_type: FilterType, ip_file_path: &Path) -> anyhow::Result<PathBuf> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let filter_file = match filter_type { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Bloom => "ips.bfb", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Bitmap => "ips.fb", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let path = BenchArgs::bin_wd_path(data_args, bloom_args).join(filter_file); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     fs::create_dir_all(path.parent().unwrap()).context("Failed to create bench dir")?; 
														 | 
														
														 | 
														
															     fs::create_dir_all(path.parent().unwrap()).context("Failed to create bench dir")?; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let filter_type_string = filter_type.to_string().to_lowercase(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let output = Command::new("/usr/bin/time") 
														 | 
														
														 | 
														
															     let output = Command::new("/usr/bin/time") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .args([ 
														 | 
														
														 | 
														
															         .args([ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // time args 
														 | 
														
														 | 
														
															             // time args 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -295,6 +315,7 @@ fn build_filter(data_args: DataArgs, bloom_args: BloomFilterArgs, ip_file_path: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             BenchArgs::bin_bin_path(data_args, bloom_args).join("tools/build_filter").to_str().unwrap(), 
														 | 
														
														 | 
														
															             BenchArgs::bin_bin_path(data_args, bloom_args).join("tools/build_filter").to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             "--force", 
														 | 
														
														 | 
														
															             "--force", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             "--timing-path", BenchArgs::bin_wd_path(data_args, bloom_args).join("filter_intern_time.json").to_str().unwrap(), 
														 | 
														
														 | 
														
															             "--timing-path", BenchArgs::bin_wd_path(data_args, bloom_args).join("filter_intern_time.json").to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            filter_type_string.as_str(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ip_file_path.to_str().unwrap(), 
														 | 
														
														 | 
														
															             ip_file_path.to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             path.to_str().unwrap() 
														 | 
														
														 | 
														
															             path.to_str().unwrap() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         ]) 
														 | 
														
														 | 
														
															         ]) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -314,19 +335,23 @@ fn build_filter(data_args: DataArgs, bloom_args: BloomFilterArgs, ip_file_path: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 type LogJoinHandle = thread::JoinHandle<anyhow::Result<()>>; 
														 | 
														
														 | 
														
															 type LogJoinHandle = thread::JoinHandle<anyhow::Result<()>>; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-fn load_xdp(bench_args: BenchArgs, filter_path: Option<&Path>) -> Result<(process::Child, LogJoinHandle, LogJoinHandle), (Option<process::Child>, anyhow::Error)> { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+fn load_xdp(bench_args: BenchArgs, filter_path: &Path) -> Result<(process::Child, LogJoinHandle, LogJoinHandle), (Option<process::Child>, anyhow::Error)> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let responder_path = bench_args.bin_path().join("responder"); 
														 | 
														
														 | 
														
															     let responder_path = bench_args.bin_path().join("responder"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let target= bench_args.bin_path().join("ebpf"); 
														 | 
														
														 | 
														
															     let target= bench_args.bin_path().join("ebpf"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let fd_info_out_path = bench_args.wd_path().join("responder_info.json"); 
														 | 
														
														 | 
														
															     let fd_info_out_path = bench_args.wd_path().join("responder_info.json"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let filter_type = bench_args.bloom_filter_args.filter_type.to_string().to_lowercase(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let mut args = Vec::from(PRIVILEGE_RUNNER); 
														 | 
														
														 | 
														
															     let mut args = Vec::from(PRIVILEGE_RUNNER); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     args.extend_from_slice(&[ 
														 | 
														
														 | 
														
															     args.extend_from_slice(&[ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         responder_path.to_str().unwrap(), 
														 | 
														
														 | 
														
															         responder_path.to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        "--filter-path", filter_path.to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         "--target", target.to_str().unwrap(), 
														 | 
														
														 | 
														
															         "--target", target.to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         "--fd-info-out-path", fd_info_out_path.to_str().unwrap(), 
														 | 
														
														 | 
														
															         "--fd-info-out-path", fd_info_out_path.to_str().unwrap(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        "--filter-type", filter_type.as_str(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     ]); 
														 | 
														
														 | 
														
															     ]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    if let Some(path) = filter_path { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        args.extend_from_slice(&["--bfb", path.to_str().unwrap()]); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    println!("{:?}", args); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let mut handle = Command::new(args.remove(0)) 
														 | 
														
														 | 
														
															     let mut handle = Command::new(args.remove(0)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         .args(args) 
														 | 
														
														 | 
														
															         .args(args) 
														 |