Skip to content

Commit 864374e

Browse files
committed
[WARP] Add number of matched functions to the ending log message for matching
Fixes #7266
1 parent 8a5d29c commit 864374e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/warp/src/plugin/workflow.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use itertools::Itertools;
1919
use rayon::iter::IntoParallelIterator;
2020
use rayon::iter::ParallelIterator;
2121
use std::collections::HashMap;
22+
use std::sync::atomic::{AtomicUsize, Ordering};
2223
use std::time::Instant;
2324
use warp::r#type::class::function::{Location, RegisterLocation, StackLocation};
2425
use warp::signature::function::{Function, FunctionGUID};
@@ -134,6 +135,7 @@ pub fn run_matcher(view: &BinaryView) {
134135

135136
// TODO: Target gets cloned a lot.
136137
// TODO: Containers might both match on the same function. What should we do?
138+
let matched_count = AtomicUsize::new(0);
137139
for_cached_containers(|container| {
138140
if background_task.is_cancelled() {
139141
return;
@@ -180,6 +182,7 @@ pub fn run_matcher(view: &BinaryView) {
180182
if let Some(matched_function) =
181183
matcher.match_function_from_constraints(function, &matched_functions)
182184
{
185+
matched_count.fetch_add(1, Ordering::Relaxed);
183186
// We were able to find a match, add it to the match cache and then mark the function
184187
// as requiring updates; this is so that we know about it in the applier activity.
185188
insert_cached_function_match(function, Some(matched_function.clone()));
@@ -193,7 +196,11 @@ pub fn run_matcher(view: &BinaryView) {
193196
log::info!("Matcher was cancelled by user, you may run it again by running the 'Run Matcher' command.");
194197
}
195198

196-
log::info!("Function matching took {:?}", start.elapsed());
199+
log::info!(
200+
"Function matching took {:.3} seconds and matched {} functions",
201+
start.elapsed().as_secs_f64(),
202+
matched_count.load(Ordering::Relaxed)
203+
);
197204
background_task.finish();
198205

199206
// Now we want to trigger re-analysis.

0 commit comments

Comments
 (0)