1use tracing::info;
2
3use crate::utils::{ProfileSummary, TargetSpec};
4
5pub fn select_targets(profile: &ProfileSummary, threshold: f32, ml_mode: bool) -> Vec<TargetSpec> {
7 let mut targets = Vec::new();
8 for hs in &profile.hotspots {
9 if hs.percent < threshold {
10 continue;
11 }
12 let reason = if ml_mode {
13 format!("{}% hotspot (ml-mode)", hs.percent)
14 } else {
15 format!("{}% hotspot", hs.percent)
16 };
17 targets.push(TargetSpec {
18 func: hs.func.clone(),
19 line: hs.line,
20 percent: hs.percent,
21 reason,
22 });
23 }
24 info!(count = targets.len(), "selected targets for generation");
25 targets
26}