diff --git a/src/lib.rs b/src/lib.rs index 3ab48492a..99525b9a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -179,6 +179,7 @@ pub fn consumer( guess_directory: bool, binary_path: Option<&Path>, ignore_parsing_error: bool, + num_threads: usize, ) { let mut gcov_type = GcovType::Unknown; @@ -290,6 +291,7 @@ pub fn consumer( profraw_paths.as_slice(), binary_path.as_ref().unwrap(), working_dir, + num_threads, ) { Ok(lcovs) => { let mut new_results: Vec<(String, CovResult)> = Vec::new(); diff --git a/src/llvm_tools.rs b/src/llvm_tools.rs index 40016b4af..af3dcd107 100644 --- a/src/llvm_tools.rs +++ b/src/llvm_tools.rs @@ -81,9 +81,11 @@ pub fn llvm_profiles_to_lcov( profile_paths: &[PathBuf], binary_path: &Path, working_dir: &Path, + num_threads: usize, ) -> Result>, String> { let profdata_path = working_dir.join("grcov.profdata"); + let num_threads = num_threads.to_string(); let args = vec![ "merge".as_ref(), "-f".as_ref(), @@ -91,6 +93,8 @@ pub fn llvm_profiles_to_lcov( "-sparse".as_ref(), "-o".as_ref(), profdata_path.as_ref(), + "--num-threads".as_ref(), + num_threads.as_ref(), ]; let stdin_paths: String = profile_paths.iter().fold("".into(), |mut a, x| { @@ -301,6 +305,7 @@ mod tests { &[tmp_path.join("default.profraw")], &PathBuf::from("src"), // There is no binary file in src tmp_path, + 1, ); assert!(lcovs.is_ok()); let lcovs = lcovs.unwrap(); @@ -317,6 +322,7 @@ mod tests { &[tmp_path.join("default.profraw")], &tmp_path.join(binary_path), tmp_path, + 1, ); assert!(lcovs.is_ok(), "Error: {}", lcovs.unwrap_err()); let lcovs = lcovs.unwrap(); @@ -349,7 +355,8 @@ mod tests { assert_eq!(status.unwrap().code().unwrap(), 0); - let lcovs = llvm_profiles_to_lcov(&[profdata_path], &tmp_path.join(binary_path), tmp_path); + let lcovs = + llvm_profiles_to_lcov(&[profdata_path], &tmp_path.join(binary_path), tmp_path, 1); assert!(lcovs.is_ok(), "Error: {}", lcovs.unwrap_err()); let lcovs = lcovs.unwrap(); @@ -396,6 +403,7 @@ mod tests { &[path_with, path_without], &tmp_path.join(bin_path), tmp_path, + 1, ); assert!(lcovs.is_ok(), "Error: {}", lcovs.unwrap_err()); diff --git a/src/main.rs b/src/main.rs index 1089dd1a3..7a83d0e79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -465,6 +465,7 @@ fn main() { guess_directory, binary_path.as_deref(), ignore_parsing_error, + num_threads, ); }) .unwrap();